Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ejimsan committed Dec 16, 2024
1 parent 2f11d32 commit 6cc69f0
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions ebl/tests/fragmentarium/test_fragments_search_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,19 +417,25 @@ def test_search_project(client, fragmentarium, project):

@pytest.mark.parametrize(
"museum",
[Museum.THE_BRITISH_MUSEUM, Museum.YALE_PEABODY_COLLECTION, Museum.THE_IRAQ_MUSEUM],
[Museum.THE_BRITISH_MUSEUM, Museum.THE_IRAQ_MUSEUM, Museum.PENN_MUSEUM],
)
@pytest.mark.parametrize(
"attribute",
["museum_name", "name"],
["name"]
)
def test_search_museum(client, fragmentarium, museum, attribute):
print(f"Testing museum: {museum.name} with attribute: {attribute}")

fragments = [
FragmentFactory.build(museum=museum) for museum in [museum, Museum.PENN_MUSEUM]
FragmentFactory.build(museum=museum)
for museum in [museum, Museum.YALE_PEABODY_COLLECTION]
]

print(f"Fragments created: {fragments}")

for fragment in fragments:
fragmentarium.create(fragment)
print(f"Fragment created in fragmentarium: {fragment}")

expected_json = {
"items": [
Expand All @@ -440,10 +446,15 @@ def test_search_museum(client, fragmentarium, museum, attribute):
"matchCountTotal": 0,
}

print(f"Expected JSON: {expected_json}")
print(f"Requesting with museum attribute: {getattr(museum, attribute)}")

result = client.simulate_get(
"/fragments/query", params={"museum": getattr(museum, attribute)}
)

print(f"Result from client: {result.status}, {result.json}")

assert result.status == falcon.HTTP_OK
assert result.json == expected_json

Expand Down

0 comments on commit 6cc69f0

Please sign in to comment.