Skip to content

Commit

Permalink
feat: add project to sdg relationship test
Browse files Browse the repository at this point in the history
  • Loading branch information
dmartin4820 committed Sep 30, 2024
1 parent fbfcabe commit a3ff267
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
pytestmark = pytest.mark.django_db

USER_PERMISSIONS_URL = reverse("user-permission-list")
PROJECT_URL = reverse("project-list")
ME_URL = reverse("my_profile")
USERS_URL = reverse("user-list")
EVENTS_URL = reverse("event-list")
Expand Down Expand Up @@ -381,3 +382,14 @@ def test_create_soc_major(auth_client):
res = auth_client.post(SOC_MAJOR_URL, payload)
assert res.status_code == status.HTTP_201_CREATED
assert res.data["title"] == payload["title"]


def test_project_sdg_xref(auth_client, project, sdg):
project.sdgs.add(sdg)
project.save()

proj_res = auth_client.get(PROJECT_URL)
sdg_res = auth_client.get(SDG_URL)

assert filter(lambda proj: str(proj["uuid"]) == str(project.pk), proj_res.data)
assert filter(lambda _sdg: str(_sdg["uuid"]) == str(sdg.pk), sdg_res)

0 comments on commit a3ff267

Please sign in to comment.