Skip to content

Commit

Permalink
Test dedupe with different relation type names (#1696)
Browse files Browse the repository at this point in the history
  • Loading branch information
blms committed Jan 28, 2025
1 parent 7963c8b commit 8caaaa8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions geniza/entities/tests/test_entities_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,14 +702,19 @@ def test_related_places(self, client):
assert response.context["related_places"][1]["name"] == str(tgreece)

# create a duplicate of the asymmetric relation to test dedupe
(neighborhood_city, _) = PlacePlaceRelationType.objects.get_or_create(
name="Neighborhood", converse_name="City"
(subset_superset, _) = PlacePlaceRelationType.objects.get_or_create(
name="Subset", converse_name="Superset"
)
PlacePlaceRelation.objects.create(
place_a=tlebanon, place_b=zahriyeh, type=neighborhood_city
place_a=tlebanon, place_b=zahriyeh, type=subset_superset
)
response = client.get(reverse("entities:place", args=(tlebanon.slug,)))
assert len(response.context["related_places"]) == 2
bothtypes = response.context["related_places"][0]["type"].lower()
assert (
city_neighborhood.converse_name.lower() in bothtypes
and subset_superset.name.lower() in bothtypes
)


@pytest.mark.django_db
Expand Down

0 comments on commit 8caaaa8

Please sign in to comment.