Skip to content

Commit

Permalink
✅ [#15] Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SilviaAmAm committed May 14, 2024
1 parent 3ddcdfc commit c4e147e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
14 changes: 9 additions & 5 deletions backend/src/openarchiefbeheer/zaken/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,23 @@ def test_expanded_correctly(self, m):

zaak_with_resultaat = Zaak.objects.get(identificatie="ZAAK-01")

self.assertEqual(zaak_with_resultaat.resultaat["toelichting"], "Test result")
self.assertEqual(
zaak_with_resultaat.resultaat["resultaattype"],
zaak_with_resultaat._expand["resultaat"]["toelichting"], "Test result"
)
self.assertEqual(
zaak_with_resultaat._expand["resultaat"]["_expand"]["resultaattype"],
{
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/bd84c463-fa65-46ef-8a9e-dd887e005aea",
},
)
self.assertEqual(
zaak_with_resultaat.zaaktype["url"],
zaak_with_resultaat._expand["zaaktype"]["url"],
"http://catalogue-api.nl/zaaktypen/111-111-111",
)
self.assertEqual(
zaak_with_resultaat.zaaktype["selectielijst_procestype"]["nummer"],
zaak_with_resultaat._expand["zaaktype"]["selectielijst_procestype"][
"nummer"
],
1,
)

Expand Down Expand Up @@ -244,6 +248,6 @@ def test_expand_no_selectielijst_service(self, m):
zaak = Zaak.objects.get(identificatie="ZAAK-01")

self.assertEqual(
zaak.zaaktype["selectielijst_procestype"],
zaak._expand["zaaktype"]["selectielijst_procestype"],
"https://selectielijst.openzaak.nl/api/v1/procestypen/e1b73b12-b2f6-4c4e-8929-94f84dd2a57d",
)
32 changes: 21 additions & 11 deletions backend/src/openarchiefbeheer/zaken/tests/test_viewsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,14 @@ def test_using_query_params_to_filter(self):

def test_filter_resultaattype(self):
zaak_1 = ZaakFactory.create(
resultaat={
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111"
_expand={
"resultaat": {
"resultaattype": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111",
"_expand": {
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111"
}
},
}
}
)
Expand All @@ -105,17 +110,22 @@ def test_filter_resultaattype(self):
) # Not expanded
ZaakFactory.create_batch(
2,
resultaat={
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222"
_expand={
"resultaat": {
"resultaattype": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222",
"_expand": {
"resultaattype": {
"url": "http://catalogue-api.nl/catalogi/api/v1/resultaattypen/222-222-222"
}
},
}
},
)

user = UserFactory(username="record_manager", role__can_start_destruction=True)

endpoint = furl(reverse("api:zaken-list"))
endpoint.args["resultaat__resultaattype__url"] = (
endpoint.args["_expand__resultaat__resultaattype"] = (
"http://catalogue-api.nl/catalogi/api/v1/resultaattypen/111-111-111"
)

Expand All @@ -129,13 +139,13 @@ def test_filter_resultaattype(self):

def test_filter_bewaartermijn(self):
zaak_1 = ZaakFactory.create(
resultaat={"resultaattype": {"archiefactietermijn": "P1D"}}
_expand={"resultaat": {"resultaattype": {"archiefactietermijn": "P1D"}}}
)
ZaakFactory.create(
resultaat="http://zaken-api.nl/zaken/api/v1/resultaten/111-111-111"
) # Not expanded
ZaakFactory.create_batch(
2, resultaat={"resultaattype": {"archiefactietermijn": "P2D"}}
2, _expand={"resultaat": {"resultaattype": {"archiefactietermijn": "P2D"}}}
)

user = UserFactory(username="record_manager", role__can_start_destruction=True)
Expand All @@ -152,13 +162,13 @@ def test_filter_bewaartermijn(self):

def test_filter_vcs(self):
zaak_1 = ZaakFactory.create(
zaaktype={"selectielijst_procestype": {"nummer": 1}}
_expand={"zaaktype": {"selectielijst_procestype": {"nummer": 1}}}
)
ZaakFactory.create(
zaaktype="http://catalogue-api.nl/zaaktypen/111-111-111",
) # Not expanded
ZaakFactory.create_batch(
2, zaaktype={"selectielijst_procestype": {"nummer": 2}}
2, _expand={"zaaktype": {"selectielijst_procestype": {"nummer": 2}}}
)

user = UserFactory(username="record_manager", role__can_start_destruction=True)
Expand Down

0 comments on commit c4e147e

Please sign in to comment.