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 19, 2024
1 parent 8eed634 commit e9d5461
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/core/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from core.models import ProgramArea

pytestmark = pytest.mark.django_db

PROJECT_URL = reverse("project-list")
ME_URL = reverse("my_profile")
USERS_URL = reverse("user-list")
EVENTS_URL = reverse("event-list")
Expand Down Expand Up @@ -358,3 +358,14 @@ def test_create_check_type(auth_client):
res = auth_client.post(CHECK_TYPE_URL, payload)
assert res.status_code == status.HTTP_201_CREATED
assert res.data["name"] == payload["name"]


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 e9d5461

Please sign in to comment.