Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applied generate_oas_component_cached() where applicable #983

Merged
merged 4 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions src/open_inwoner/cms/cases/tests/test_contactform.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
)
from open_inwoner.openzaak.models import CatalogusConfig, OpenZaakConfig
from open_inwoner.openzaak.tests.factories import ServiceFactory, ZaakTypeConfigFactory
from open_inwoner.openzaak.tests.helpers import generate_oas_component_cached
from open_inwoner.openzaak.tests.shared import (
CATALOGI_ROOT,
DOCUMENTEN_ROOT,
Expand Down Expand Up @@ -87,7 +88,7 @@ def setUp(self):
)
self.ok_config.save()

self.zaak = generate_oas_component(
self.zaak = generate_oas_component_cached(
"zrc",
"schemas/Zaak",
uuid="d8bbdeb7-770f-4ca9-b1ea-77b4730bf67d",
Expand All @@ -101,7 +102,7 @@ def setUp(self):
resultaat=f"{ZAKEN_ROOT}resultaten/a44153aa-ad2c-6a07-be75-15add5113",
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
)
self.user_role = generate_oas_component(
self.user_role = generate_oas_component_cached(
"zrc",
"schemas/Rol",
url=f"{ZAKEN_ROOT}rollen/f33153aa-ad2c-4a07-ae75-15add5891",
Expand All @@ -114,7 +115,7 @@ def setUp(self):
"geslachtsnaam": "Bazz",
},
)
self.eherkenning_user_role = generate_oas_component(
self.eherkenning_user_role = generate_oas_component_cached(
"zrc",
"schemas/Rol",
url=f"{ZAKEN_ROOT}rollen/3ff7686f-db35-4181-8e48-57521220f887",
Expand All @@ -127,7 +128,7 @@ def setUp(self):
"geslachtsnaam": "Bazz",
},
)
self.eherkenning_user_role_kvk = generate_oas_component(
self.eherkenning_user_role_kvk = generate_oas_component_cached(
"zrc",
"schemas/Rol",
url=f"{ZAKEN_ROOT}rollen/5885531e-9b7f-46af-947e-f2278a2e72a8",
Expand All @@ -140,7 +141,7 @@ def setUp(self):
"geslachtsnaam": "Bazz",
},
)
self.zaaktype = generate_oas_component(
self.zaaktype = generate_oas_component_cached(
"ztc",
"schemas/ZaakType",
uuid="0caa29cb-0167-426f-8dc1-88bebd7c8804",
Expand All @@ -154,7 +155,7 @@ def setUp(self):
#
# statuses
#
self.status_new = generate_oas_component(
self.status_new = generate_oas_component_cached(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da81560-c7fc-476a-ad13-beu760sle929",
Expand All @@ -163,7 +164,7 @@ def setUp(self):
datumStatusGezet="2021-01-12",
statustoelichting="",
)
self.status_finish = generate_oas_component(
self.status_finish = generate_oas_component_cached(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da89990-c7fc-476a-ad13-c9023450083c",
Expand All @@ -175,7 +176,7 @@ def setUp(self):
#
# status types
#
self.status_type_new = generate_oas_component(
self.status_type_new = generate_oas_component_cached(
"ztc",
"schemas/StatusType",
url=self.status_new["statustype"],
Expand All @@ -188,7 +189,7 @@ def setUp(self):
isEindstatus=False,
)
# no associated status (for testing `add_second_status_preview`)
self.status_type_in_behandeling = generate_oas_component(
self.status_type_in_behandeling = generate_oas_component_cached(
"ztc",
"schemas/StatusType",
url=f"{CATALOGI_ROOT}statustypen/167cb935-ac8a-428e-8cca-5abda0da47c7",
Expand All @@ -200,7 +201,7 @@ def setUp(self):
volgnummer=3,
isEindstatus=False,
)
self.status_type_finish = generate_oas_component(
self.status_type_finish = generate_oas_component_cached(
"ztc",
"schemas/StatusType",
url=self.status_finish["statustype"],
Expand All @@ -212,7 +213,7 @@ def setUp(self):
volgnummer=1,
isEindstatus=True,
)
self.result = generate_oas_component(
self.result = generate_oas_component_cached(
"zrc",
"schemas/Resultaat",
uuid="a44153aa-ad2c-6a07-be75-15add5113",
Expand All @@ -221,7 +222,7 @@ def setUp(self):
zaak=self.zaak["url"],
toelichting="resultaat toelichting",
)
self.klant = generate_oas_component(
self.klant = generate_oas_component_cached(
"kc",
"schemas/Klant",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
Expand Down Expand Up @@ -296,7 +297,7 @@ def _setUpMocks(self, m):
]

def _setUpExtraMocks(self, m):
self.contactmoment = generate_oas_component(
self.contactmoment = generate_oas_component_cached(
"cmc",
"schemas/ContactMoment",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb",
Expand All @@ -305,7 +306,7 @@ def _setUpExtraMocks(self, m):
antwoord="",
text="hey!\n\nwaddup?",
)
self.klant_contactmoment = generate_oas_component(
self.klant_contactmoment = generate_oas_component_cached(
"cmc",
"schemas/KlantContactMoment",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-cccccccccccc",
Expand Down
41 changes: 21 additions & 20 deletions src/open_inwoner/cms/cases/tests/test_htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
VertrouwelijkheidsAanduidingen,
)
from zgw_consumers.constants import APITypes
from zgw_consumers.test import generate_oas_component, mock_service_oas_get
from zgw_consumers.test import mock_service_oas_get

from open_inwoner.accounts.tests.factories import DigidUserFactory
from open_inwoner.cms.tests import cms_tools
Expand All @@ -31,6 +31,7 @@
ZaakTypeInformatieObjectTypeConfigFactory,
ZaakTypeStatusTypeConfigFactory,
)
from open_inwoner.openzaak.tests.helpers import generate_oas_component_cached
from open_inwoner.openzaak.tests.shared import (
CATALOGI_ROOT,
DOCUMENTEN_ROOT,
Expand Down Expand Up @@ -101,7 +102,7 @@ def setUp(self) -> None:
)
self.ok_config.save()

self.zaak = generate_oas_component(
self.zaak = generate_oas_component_cached(
"zrc",
"schemas/Zaak",
uuid="d8bbdeb7-770f-4ca9-b1ea-77b4730bf67d",
Expand All @@ -115,7 +116,7 @@ def setUp(self) -> None:
resultaat=f"{ZAKEN_ROOT}resultaten/a44153aa-ad2c-6a07-be75-15add5113",
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
)
self.zaaktype = generate_oas_component(
self.zaaktype = generate_oas_component_cached(
"ztc",
"schemas/ZaakType",
uuid="0caa29cb-0167-426f-8dc1-88bebd7c8804",
Expand All @@ -129,7 +130,7 @@ def setUp(self) -> None:
#
# statuses
#
self.status_new = generate_oas_component(
self.status_new = generate_oas_component_cached(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da81560-c7fc-476a-ad13-beu760sle929",
Expand All @@ -138,7 +139,7 @@ def setUp(self) -> None:
datumStatusGezet="2021-01-12",
statustoelichting="",
)
self.status_finish = generate_oas_component(
self.status_finish = generate_oas_component_cached(
"zrc",
"schemas/Status",
url=f"{ZAKEN_ROOT}statussen/3da89990-c7fc-476a-ad13-c9023450083c",
Expand All @@ -150,7 +151,7 @@ def setUp(self) -> None:
#
# status types
#
self.status_type_new = generate_oas_component(
self.status_type_new = generate_oas_component_cached(
"ztc",
"schemas/StatusType",
url=self.status_new["statustype"],
Expand All @@ -162,7 +163,7 @@ def setUp(self) -> None:
volgnummer=1,
isEindstatus=False,
)
self.status_type_finish = generate_oas_component(
self.status_type_finish = generate_oas_component_cached(
"ztc",
"schemas/StatusType",
url=self.status_finish["statustype"],
Expand All @@ -174,7 +175,7 @@ def setUp(self) -> None:
volgnummer=1,
isEindstatus=True,
)
self.user_role = generate_oas_component(
self.user_role = generate_oas_component_cached(
"zrc",
"schemas/Rol",
url=f"{ZAKEN_ROOT}rollen/f33153aa-ad2c-4a07-ae75-15add5891",
Expand All @@ -187,7 +188,7 @@ def setUp(self) -> None:
"geslachtsnaam": "Bazz",
},
)
self.result = generate_oas_component(
self.result = generate_oas_component_cached(
"zrc",
"schemas/Resultaat",
uuid="a44153aa-ad2c-6a07-be75-15add5113",
Expand All @@ -196,22 +197,22 @@ def setUp(self) -> None:
zaak=self.zaak["url"],
toelichting="resultaat toelichting",
)
self.zaak_informatie_object = generate_oas_component(
self.zaak_informatie_object = generate_oas_component_cached(
"zrc",
"schemas/ZaakInformatieObject",
url=f"{ZAKEN_ROOT}zaakinformatieobjecten/e55153aa-ad2c-4a07-ae75-15add57d6",
informatieobject=f"{DOCUMENTEN_ROOT}enkelvoudiginformatieobjecten/014c38fe-b010-4412-881c-3000032fb812",
zaak=self.zaak["url"],
registratiedatum="2021-01-12",
)
self.informatie_object_type = generate_oas_component(
self.informatie_object_type = generate_oas_component_cached(
"ztc",
"schemas/InformatieObjectType",
url=f"{CATALOGI_ROOT}informatieobjecttype/014c38fe-b010-4412-881c-3000032fb321",
catalogus=f"{CATALOGI_ROOT}catalogussen/1b643db-81bb-d71bd5a2317a",
omschrijving="Some content",
)
self.zaaktype_informatie_object_type = generate_oas_component(
self.zaaktype_informatie_object_type = generate_oas_component_cached(
"ztc",
"schemas/ZaakTypeInformatieObjectType",
uuid="3fb03882-f6f9-4e0d-ad92-f810e24b9abb",
Expand All @@ -223,7 +224,7 @@ def setUp(self) -> None:
richting="inkomend",
statustype=self.status_type_finish,
)
self.informatie_object = generate_oas_component(
self.informatie_object = generate_oas_component_cached(
"drc",
"schemas/EnkelvoudigInformatieObject",
uuid="014c38fe-b010-4412-881c-3000032fb812",
Expand All @@ -238,7 +239,7 @@ def setUp(self) -> None:
)

# for upload testing
self.uploaded_zaak_informatie_object = generate_oas_component(
self.uploaded_zaak_informatie_object = generate_oas_component_cached(
"zrc",
"schemas/ZaakInformatieObject",
url=f"{ZAKEN_ROOT}zaakinformatieobjecten/48599f76-b524-48e8-be5a-6fc47288c9bf",
Expand All @@ -247,7 +248,7 @@ def setUp(self) -> None:
registratiedatum="2022-01-12",
)
self.uploaded_zaak_informatie_object_content = "test56789".encode("utf8")
self.uploaded_informatie_object = generate_oas_component(
self.uploaded_informatie_object = generate_oas_component_cached(
"drc",
"schemas/EnkelvoudigInformatieObject",
uuid="48599f76-b524-48e8-be5a-6fc47288c9bf",
Expand All @@ -260,7 +261,7 @@ def setUp(self) -> None:
titel="uploaded_test_file.txt",
bestandsomvang=len(self.uploaded_zaak_informatie_object_content),
)
self.klant = generate_oas_component(
self.klant = generate_oas_component_cached(
"kc",
"schemas/Klant",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
Expand All @@ -271,7 +272,7 @@ def setUp(self) -> None:
emailadres="foo@example.com",
telefoonnummer="0612345678",
)
self.contactmoment = generate_oas_component(
self.contactmoment = generate_oas_component_cached(
"cmc",
"schemas/ContactMoment",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-bbbbbbbbbbbb",
Expand All @@ -280,7 +281,7 @@ def setUp(self) -> None:
antwoord="",
text="hey!\n\nwaddup?",
)
self.klant_contactmoment = generate_oas_component(
self.klant_contactmoment = generate_oas_component_cached(
"cmc",
"schemas/KlantContactMoment",
uuid="aaaaaaaa-aaaa-aaaa-aaaa-cccccccccccc",
Expand Down Expand Up @@ -521,7 +522,7 @@ def mock_list(request, context):
Creates schemas/ZaakInformatieObject dict for each item in uploads.
"""
items = [
generate_oas_component(
generate_oas_component_cached(
"zrc",
"schemas/ZaakInformatieObject",
url=f"{ZAKEN_ROOT}zaakinformatieobjecten/e55153aa-ad2c-4a07-ae75-15add57d6",
Expand Down Expand Up @@ -553,7 +554,7 @@ def mock_upload(request, context):
seed = file_name.ljust(16, "0").encode("utf-8")
uuid = UUID(bytes=seed)

uploaded_informatie_object = generate_oas_component(
uploaded_informatie_object = generate_oas_component_cached(
"drc",
"schemas/EnkelvoudigInformatieObject",
uuid=str(uuid),
Expand Down
Loading
Loading