Skip to content

Commit

Permalink
Cope with harmless changes in messaging schemas
Browse files Browse the repository at this point in the history
Previously, the test compared reported application names with a
hard-coded list. Now it just checks that these applications are present
and ignores difference in case.

Fixes: #845

Signed-off-by: Nils Philippsen <nils@redhat.com>
  • Loading branch information
nphilipp committed Apr 12, 2023
1 parent 3d0e555 commit ab03e61
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions tests/api/handlers/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,46 @@

class TestMisc(BaseTestAPIV1Handler):
def test_get_applications(self, client):
EXPECTED_APPS = {
appname.lower()
for appname in (
"anitya",
"ansible",
"bodhi",
"ci_messages",
"copr",
"discourse",
"distgit",
"elections",
"FAS",
"fedocal",
"FMN",
"hotness",
"Koji",
"mdapi",
"nuancier",
"pagure",
"planet",
)
}

response = client.get(f"{self.path}/applications")

assert response.status_code == status.HTTP_200_OK

result = response.json()

assert isinstance(result, list)
assert all(isinstance(item, str) for item in result)
# Verify list is sorted and items are unique
assert "base" not in result
assert result == [
"anitya",
"ansible",
"bodhi",
"ci_messages",
"copr",
"discourse",
"distgit",
"elections",
"FAS",
"fedocal",
"FMN",
"hotness",
"Koji",
"mdapi",
"nuancier",
"pagure",
"planet",
]

result_lower = [appname.lower() for appname in result]

# Verify list is sorted and items are unique
assert result_lower == sorted(set(result_lower))

# Verify all expected apps are present
assert EXPECTED_APPS <= set(result_lower)

@staticmethod
def mock_distgit_owned_projects(respx_mocker, settings, ownertype):
Expand Down

0 comments on commit ab03e61

Please sign in to comment.