Skip to content

Commit

Permalink
Add test for ensuring image listing returns distinct images
Browse files Browse the repository at this point in the history
  • Loading branch information
danlamanna committed Aug 22, 2023
1 parent a3599be commit c95bd76
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions isic/core/tests/test_api_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ def test_core_api_image_list_shares(private_image, authenticated_client, user, s
assert r.json()["count"] == 1


# Can be removed once https://github.com/ImageMarkup/tracker/issues/77 is resolved
@pytest.mark.django_db
def test_core_api_image_list_no_duplicates(private_image, authenticated_client, user, staff_user):
private_image.accession.cohort.contributor.owners.add(user)
private_image.shares.add(user, through_defaults={"creator": staff_user})
private_image.save()

r = authenticated_client.get("/api/v2/images/")
assert r.status_code == 200, r.json()
assert r.json()["count"] == 1


@pytest.mark.django_db
def test_core_api_image_detail(images, authenticated_client, staff_client):
public_image_id = images[0].isic_id
Expand Down

0 comments on commit c95bd76

Please sign in to comment.