Skip to content

Tests only verify response shape, not correctness of values #15

@jtdub

Description

@jtdub

Problem

Most tests only assert status_code == 200 and that expected keys exist in the response. They do not verify the actual values returned. For example:

  • test_compare_configs doesn't assert that has_changes is True.
  • test_search_config doesn't assert that the matches actually contain the expected interface lines or that match_count > 0.
  • test_parse_config doesn't assert anything about the structure of structured_config.

These tests would pass even if the services returned incorrect data.

Suggested Fix

Add value assertions to each test. For example:

def test_compare_configs(...):
    ...
    assert data["has_changes"] is True
    assert "hostname" in data["unified_diff"]

def test_search_config(...):
    ...
    assert data["match_count"] == 2
    assert any("GigabitEthernet0/0" in m for m in data["matches"])

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions