-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #937 from maykinmedia/feature/2002-case-notificati…
…ons-for-companies ✨ [#2002] Implement Zaken notifications for companies
- Loading branch information
Showing
3 changed files
with
149 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,10 @@ | |
from zgw_consumers.constants import APITypes | ||
from zgw_consumers.test import generate_oas_component, mock_service_oas_get | ||
|
||
from open_inwoner.accounts.tests.factories import DigidUserFactory | ||
from open_inwoner.accounts.tests.factories import ( | ||
DigidUserFactory, | ||
eHerkenningUserFactory, | ||
) | ||
from open_inwoner.openzaak.tests.factories import ( | ||
NotificationFactory, | ||
ServiceFactory, | ||
|
@@ -54,6 +57,11 @@ def __init__(self): | |
bsn="100000001", | ||
email="[email protected]", | ||
) | ||
self.eherkenning_user_initiator = eHerkenningUserFactory( | ||
kvk="12345678", | ||
rsin="000000000", | ||
email="[email protected]", | ||
) | ||
self.zaak_type = generate_oas_component( | ||
"ztc", | ||
"schemas/ZaakType", | ||
|
@@ -93,6 +101,15 @@ def __init__(self): | |
resultaat=f"{ZAKEN_ROOT}resultaten/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", | ||
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar, | ||
) | ||
self.zaak2 = generate_oas_component( | ||
"zrc", | ||
"schemas/Zaak", | ||
url=f"{ZAKEN_ROOT}zaken/bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb", | ||
zaaktype=self.zaak_type["url"], | ||
status=f"{ZAKEN_ROOT}statussen/aaaaaaaa-aaaa-aaaa-aaaa-222222222222", | ||
resultaat=f"{ZAKEN_ROOT}resultaten/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa", | ||
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar, | ||
) | ||
self.status_initial = generate_oas_component( | ||
"zrc", | ||
"schemas/Status", | ||
|
@@ -123,6 +140,13 @@ def __init__(self): | |
informatieobject=self.informatie_object["url"], | ||
zaak=self.zaak["url"], | ||
) | ||
self.zaak_informatie_object2 = generate_oas_component( | ||
"zrc", | ||
"schemas/ZaakInformatieObject", | ||
url=f"{ZAKEN_ROOT}zaakinformatieobjecten/aaaaaaaa-0002-aaaa-aaaa-aaaaaaaaaaaa", | ||
informatieobject=self.informatie_object["url"], | ||
zaak=self.zaak2["url"], | ||
) | ||
|
||
self.role_initiator = generate_oas_component( | ||
"zrc", | ||
|
@@ -134,8 +158,32 @@ def __init__(self): | |
"inpBsn": self.user_initiator.bsn, | ||
}, | ||
) | ||
self.eherkenning_role_initiator = generate_oas_component( | ||
"zrc", | ||
"schemas/Rol", | ||
url=f"{ZAKEN_ROOT}rollen/aaaaaaaa-0002-aaaa-aaaa-aaaaaaaaaaaa", | ||
omschrijvingGeneriek=RolOmschrijving.initiator, | ||
betrokkeneType=RolTypes.niet_natuurlijk_persoon, | ||
betrokkeneIdentificatie={ | ||
"innNnpId": self.eherkenning_user_initiator.kvk, | ||
}, | ||
) | ||
self.eherkenning_role_initiator2 = generate_oas_component( | ||
"zrc", | ||
"schemas/Rol", | ||
url=f"{ZAKEN_ROOT}rollen/aaaaaaaa-0003-aaaa-aaaa-aaaaaaaaaaaa", | ||
omschrijvingGeneriek=RolOmschrijving.initiator, | ||
betrokkeneType=RolTypes.niet_natuurlijk_persoon, | ||
betrokkeneIdentificatie={ | ||
"innNnpId": self.eherkenning_user_initiator.rsin, | ||
}, | ||
) | ||
|
||
self.case_roles = [self.role_initiator] | ||
self.eherkenning_case_roles = [ | ||
self.eherkenning_role_initiator, | ||
self.eherkenning_role_initiator2, | ||
] | ||
self.status_history = [self.status_initial, self.status_final] | ||
|
||
self.status_notification = NotificationFactory( | ||
|
@@ -150,6 +198,12 @@ def __init__(self): | |
resource_url=self.zaak_informatie_object["url"], | ||
hoofd_object=self.zaak["url"], | ||
) | ||
self.zio_notification2 = NotificationFactory( | ||
resource="zaakinformatieobject", | ||
actie="create", | ||
resource_url=self.zaak_informatie_object2["url"], | ||
hoofd_object=self.zaak2["url"], | ||
) | ||
|
||
def setUpOASMocks(self, m): | ||
mock_service_oas_get(m, ZAKEN_ROOT, "zrc") | ||
|
@@ -171,6 +225,10 @@ def install_mocks(self, m, *, res404: Optional[List[str]] = None) -> "MockAPIDat | |
f"{ZAKEN_ROOT}rollen?zaak={self.zaak['url']}", | ||
json=paginated_response(self.case_roles), | ||
) | ||
m.get( | ||
f"{ZAKEN_ROOT}rollen?zaak={self.zaak2['url']}", | ||
json=paginated_response(self.eherkenning_case_roles), | ||
) | ||
|
||
if "status_history" in res404: | ||
m.get(f"{ZAKEN_ROOT}statussen?zaak={self.zaak['url']}", status_code=404) | ||
|
@@ -182,6 +240,7 @@ def install_mocks(self, m, *, res404: Optional[List[str]] = None) -> "MockAPIDat | |
|
||
for resource_attr in [ | ||
"zaak", | ||
"zaak2", | ||
"zaak_type", | ||
"status_initial", | ||
"status_final", | ||
|
@@ -190,6 +249,7 @@ def install_mocks(self, m, *, res404: Optional[List[str]] = None) -> "MockAPIDat | |
"status_type_final", | ||
"informatie_object", | ||
"zaak_informatie_object", | ||
"zaak_informatie_object2", | ||
]: | ||
resource = getattr(self, resource_attr) | ||
if resource_attr in res404: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters