def test_filter_by_zaak(self): eio = EnkelvoudigInformatieObjectFactory.create() eio_url = eio.get_url() self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) self.create_zaak_besluit_services() zaak = self.create_zaak() zio = ZaakInformatieObjectFactory.create(informatieobject=eio_url, zaak=zaak) zaak_url = reverse(zio.zaak) zio_list_url = reverse("zaakinformatieobject-list") response = self.client.get( zio_list_url, {"zaak": f"http://openzaak.nl{zaak_url}"}, HTTP_HOST="openzaak.nl", ) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.data), 1) self.assertEqual(response.data[0]["zaak"], f"http://openzaak.nl{zaak_url}")
def test_besluitinformatieobject_create_fail_send_notification_create_db_entry( self, ): url = get_operation_url("besluitinformatieobject_create") besluit = BesluitFactory.create() io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) besluit.besluittype.informatieobjecttypen.add(io.informatieobjecttype) besluit_url = reverse(besluit) io_url = reverse(io) data = { "informatieobject": f"http://testserver{io_url}", "besluit": f"http://testserver{besluit_url}", } response = self.client.post(url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.data) data = response.json() self.assertEqual(StatusLog.objects.count(), 1) logged_warning = StatusLog.objects.get() failed = FailedNotification.objects.get() message = { "aanmaakdatum": "2019-01-01T12:00:00Z", "actie": "create", "hoofdObject": f"http://testserver{reverse(besluit)}", "kanaal": "besluiten", "kenmerken": { "verantwoordelijkeOrganisatie": besluit.verantwoordelijke_organisatie, "besluittype": f"http://testserver{reverse(besluit.besluittype)}", }, "resource": "besluitinformatieobject", "resourceUrl": data["url"], } self.assertEqual(failed.statuslog_ptr, logged_warning) self.assertEqual(failed.message, message)
def test_patch_besluit_not_allowed(self): bio = BesluitInformatieObjectFactory.create() bio_detail_url = reverse(bio) besluit = BesluitFactory.create() besluit_url = reverse(besluit) io = EnkelvoudigInformatieObjectFactory.create() io_url = reverse(io) response = self.client.patch( bio_detail_url, { "besluit": f"http://testserver{besluit_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual( response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED, response.data )
def test_zaakinformatieobject_create_fail_send_notification_create_db_entry(self): url = get_operation_url("zaakinformatieobject_create") zaak = ZaakFactory.create() io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False ) ZaakTypeInformatieObjectTypeFactory.create( zaaktype=zaak.zaaktype, informatieobjecttype=io.informatieobjecttype ) zaak_url = reverse(zaak) io_url = reverse(io) data = { "informatieobject": f"http://testserver{io_url}", "zaak": f"http://testserver{zaak_url}", } response = self.client.post(url, data) self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.data) data = response.json() self.assertEqual(StatusLog.objects.count(), 1) logged_warning = StatusLog.objects.get() failed = FailedNotification.objects.get() message = { "aanmaakdatum": "2019-01-01T12:00:00Z", "actie": "create", "hoofdObject": f"http://testserver{zaak_url}", "kanaal": "zaken", "kenmerken": { "bronorganisatie": zaak.bronorganisatie, "zaaktype": f"http://testserver{reverse(zaak.zaaktype)}", "vertrouwelijkheidaanduiding": zaak.vertrouwelijkheidaanduiding, }, "resource": "zaakinformatieobject", "resourceUrl": data["url"], } self.assertEqual(failed.statuslog_ptr, logged_warning) self.assertEqual(failed.message, message)
def test_create_bio(self): besluit = BesluitFactory.create() besluit_url = get_operation_url("besluit_read", uuid=besluit.uuid) informatieobject = EnkelvoudigInformatieObjectFactory.create() add_url = reverse("admin:besluiten_besluitinformatieobject_add") data = { "uuid": uuid.uuid4(), "besluit": besluit.id, "_informatieobject": informatieobject.canonical.id, } self.client.post(add_url, data) self.assertEqual(BesluitInformatieObject.objects.count(), 1) bio = BesluitInformatieObject.objects.get() bio_url = get_operation_url("besluitinformatieobject_read", uuid=bio.uuid) self.assertEqual(AuditTrail.objects.count(), 1) audittrail = AuditTrail.objects.get() self.assertEqual(audittrail.bron, "BRC") self.assertEqual(audittrail.actie, "create") self.assertEqual(audittrail.resultaat, 0) self.assertEqual(audittrail.applicatie_weergave, "admin") self.assertEqual(audittrail.gebruikers_id, f"{self.user.id}"), self.assertEqual(audittrail.gebruikers_weergave, self.user.get_full_name()), self.assertEqual(audittrail.hoofd_object, f"http://testserver{besluit_url}"), self.assertEqual(audittrail.resource, "besluitinformatieobject"), self.assertEqual(audittrail.resource_url, f"http://testserver{bio_url}"), self.assertEqual(audittrail.resource_weergave, bio.unique_representation()), self.assertEqual(audittrail.oud, None) new_data = audittrail.nieuw self.assertEqual(new_data["besluit"], f"http://testserver{besluit_url}")
def test_create_bio_limited_to_authorized_besluiten(self): informatieobject = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) informatieobject_url = f"http://testserver{reverse(informatieobject)}" self.adapter.get( informatieobject_url, json=serialise_eio(informatieobject, informatieobject_url), ) besluit1 = BesluitFactory.create(besluittype=self.besluittype) besluit2 = BesluitFactory.create() self.besluittype.informatieobjecttypen.add( informatieobject.informatieobjecttype) besluit2.besluittype.informatieobjecttypen.add( informatieobject.informatieobjecttype) besluit_uri1 = reverse(besluit1) besluit_url1 = f"http://testserver{besluit_uri1}" besluit_uri2 = reverse(besluit2) besluit_url2 = f"http://testserver{besluit_uri2}" url1 = reverse("besluitinformatieobject-list") url2 = reverse("besluitinformatieobject-list") data1 = { "informatieobject": informatieobject_url, "besluit": besluit_url1 } data2 = { "informatieobject": informatieobject_url, "besluit": besluit_url2 } response1 = self.client.post(url1, data1) response2 = self.client.post(url2, data2) self.assertEqual(response1.status_code, status.HTTP_201_CREATED, response1.data) self.assertEqual(response2.status_code, status.HTTP_403_FORBIDDEN, response2.data)
def test_filter_by_informatieobject(self): io = EnkelvoudigInformatieObjectFactory.create() io_url = f"http://example.com{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) self.create_zaak_besluit_services() besluit = self.create_besluit() BesluitInformatieObjectFactory.create(informatieobject=io_url, besluit=besluit) bio_list_url = reverse("besluitinformatieobject-list") response = self.client.get( bio_list_url, {"informatieobject": io_url}, HTTP_HOST="example.com", ) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.data), 1) self.assertEqual(response.data[0]["informatieobject"], io_url)
def test_read_besluit(self): io = EnkelvoudigInformatieObjectFactory.create() io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) bio = BesluitInformatieObjectFactory.create(informatieobject=io_url) bio_detail_url = reverse(bio) response = self.client.get(bio_detail_url) self.assertEqual(response.status_code, status.HTTP_200_OK) besluit_url = reverse(bio.besluit) expected = { "url": f"http://testserver{bio_detail_url}", "informatieobject": io_url, "besluit": f"http://testserver{besluit_url}", } self.assertEqual(response.json(), expected)
def test_filter_by_besluit(self): io = EnkelvoudigInformatieObjectFactory.create() io_url = io.get_url() self.adapter.get(io_url, json=serialise_eio(io, io_url)) self.create_zaak_besluit_services() besluit = self.create_besluit() bio = BesluitInformatieObjectFactory.create(informatieobject=io_url, besluit=besluit) besluit_url = reverse(bio.besluit) bio_list_url = reverse("besluitinformatieobject-list") response = self.client.get( bio_list_url, {"besluit": f"http://openzaak.nl{besluit_url}"}, HTTP_HOST="openzaak.nl", ) self.assertEqual(response.status_code, 200) self.assertEqual(len(response.data), 1) self.assertEqual(response.data[0]["besluit"], f"http://openzaak.nl{besluit_url}")
def test_informatieobject_create(self): zaak = ZaakFactory.create() zaak_url = reverse(zaak) io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = reverse(io) ZaakTypeInformatieObjectTypeFactory.create( informatieobjecttype=io.informatieobjecttype, zaaktype=zaak.zaaktype) url = reverse(ZaakInformatieObject) response = self.client.post( url, { "zaak": f"http://testserver{zaak_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_update_informatieobject_fails(self): io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) self.create_zaak_besluit_services() zaak = self.create_zaak() zio = ZaakInformatieObjectFactory.create( informatieobject=io_url, informatieobject__informatieobjecttype=io.informatieobjecttype, zaak=zaak, ) zio_url = reverse(zio) response = self.client.patch(zio_url, {"informatieobject": io_url}) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) validation_error = get_validation_errors(response, "informatieobject") self.assertEqual(validation_error["code"], IsImmutableValidator.code)
def test_informatieobject_no_zaaktype_informatieobjecttype_relation(self): zaak = ZaakFactory.create() zaak_url = reverse(zaak) io = EnkelvoudigInformatieObjectFactory.create() io_url = reverse(io) url = reverse(ZaakInformatieObject) response = self.client.post( url, { "zaak": f"http://testserver{zaak_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) validation_error = get_validation_errors(response, "nonFieldErrors") self.assertEqual(validation_error["code"], "missing-zaaktype-informatieobjecttype-relation")
def test_validate_no_informatieobjecttype_zaaktype_relation(self): zaak = ZaakFactory.create() besluit = BesluitFactory.create(zaak=zaak) besluit_url = reverse(besluit) io = EnkelvoudigInformatieObjectFactory.create() io_url = reverse(io) url = reverse("besluitinformatieobject-list") response = self.client.post( url, { "besluit": f"http://testserver{besluit_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) error = get_validation_errors(response, "nonFieldErrors") self.assertEqual(error["code"], "missing-zaaktype-informatieobjecttype-relation")
def test_delete_no_url_mapping(self): eio = EnkelvoudigInformatieObjectFactory.create() eio_url = eio.get_url() self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) self.create_zaak_besluit_services() zaak = self.create_zaak() zio = ZaakInformatieObjectFactory.create(informatieobject=eio_url, zaak=zaak) zio_url = reverse(zio) # Remove all available mappings UrlMapping.objects.all().delete() response = self.client.delete(zio_url) # Test response self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.data["detail"], "CMIS-adapter could not shrink one of the URL fields.", )
def test_zaakinformatieobject_delete_fail_send_notification_create_db_entry( self): io = EnkelvoudigInformatieObjectFactory.create() io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) self.create_zaak_besluit_services() zio = ZaakInformatieObjectFactory.create(informatieobject=io_url, zaak=self.create_zaak()) url = reverse(zio) with capture_on_commit_callbacks(execute=True): response = self.client.delete(url) self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) self.assertEqual(StatusLog.objects.count(), 1) logged_warning = StatusLog.objects.get() failed = FailedNotification.objects.get() message = { "aanmaakdatum": "2019-01-01T12:00:00Z", "actie": "destroy", "hoofdObject": f"http://testserver{reverse(zio.zaak)}", "kanaal": "zaken", "kenmerken": { "bronorganisatie": zio.zaak.bronorganisatie, "zaaktype": f"http://testserver{reverse(zio.zaak.zaaktype)}", "vertrouwelijkheidaanduiding": zio.zaak.vertrouwelijkheidaanduiding, }, "resource": "zaakinformatieobject", "resourceUrl": f"http://testserver{url}", } self.assertEqual(failed.statuslog_ptr, logged_warning) self.assertEqual(failed.message, message)
def test_create_no_url_mapping(self): self.create_zaak_besluit_services() zaak = self.create_zaak() zaak_url = reverse(zaak) io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) ZaakTypeInformatieObjectTypeFactory.create( informatieobjecttype=io.informatieobjecttype, zaaktype=zaak.zaaktype) titel = "some titel" beschrijving = "some beschrijving" content = { "informatieobject": io_url, "zaak": f"http://testserver{zaak_url}", "titel": titel, "beschrijving": beschrijving, "aardRelatieWeergave": "bla", # Should be ignored by the API } # Remove all available mappings UrlMapping.objects.all().delete() # Send to the API response = self.client.post( reverse("zaakinformatieobject-list", kwargs={"version": "1"}), content) # Test response self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.data["detail"], "CMIS-adapter could not shrink one of the URL fields.", )
def test_zaakinformatieobjecten(self): io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__zaaktypen__zaaktype=self.zaaktype, informatieobjecttype__catalogus=self.zaaktype.catalogus, ) io_url = reverse(io) zio = ZaakInformatieObjectFactory( zaak=self.zaak, informatieobject__latest_version__informatieobjecttype__zaaktypen__zaaktype=self.zaaktype, informatieobject__latest_version__informatieobjecttype__catalogus=self.zaaktype.catalogus, ) zio_url = reverse(zio) self.assertCreateAllowed( reverse(ZaakInformatieObject), { "zaak": reverse(self.zaak), "informatieobject": f"http://testserver{io_url}", }, ) self.assertUpdateAllowed(zio_url) self.assertPartialUpdateAllowed(zio_url) self.assertDestroyAllowed(zio_url)
def test_partial_update_zaak_and_informatieobject_fails(self): zaak = ZaakFactory.create() zaak_url = reverse(zaak) zio = ZaakInformatieObjectFactory.create() zio_detail_url = reverse(zio) io = EnkelvoudigInformatieObjectFactory.create() io_url = reverse(io) response = self.client.patch( zio_detail_url, { "zaak": f"http://testserver{zaak_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.data) for field in ["zaak", "informatieobject"]: with self.subTest(field=field): error = get_validation_errors(response, field) self.assertEqual(error["code"], IsImmutableValidator.code)
def test_send_notif_delete_besluitinformatieobject(self, mock_client): """ Check if notifications will be send when besluitinformatieobject is deleted """ client = mock_client.return_value besluit = BesluitFactory.create() besluit_url = get_operation_url("besluit_read", uuid=besluit.uuid) besluittype_url = reverse(besluit.besluittype) eio = EnkelvoudigInformatieObjectFactory.create() eio_url = eio.get_url() self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) bio = BesluitInformatieObjectFactory.create(besluit=besluit, informatieobject=eio_url) bio_url = get_operation_url("besluitinformatieobject_delete", uuid=bio.uuid) response = self.client.delete(bio_url) self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT, response.data) client.create.assert_called_once_with( "notificaties", { "kanaal": "besluiten", "hoofdObject": f"http://testserver{besluit_url}", "resource": "besluitinformatieobject", "resourceUrl": f"http://testserver{bio_url}", "actie": "destroy", "aanmaakdatum": "2018-09-07T00:00:00Z", "kenmerken": { "verantwoordelijkeOrganisatie": besluit.verantwoordelijke_organisatie, "besluittype": f"http://testserver{besluittype_url}", }, }, )
def test_besluitinformatieobject_delete_fail_send_notification_create_db_entry( self, ): eio = EnkelvoudigInformatieObjectFactory.create() eio_url = eio.get_url() self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) self.create_zaak_besluit_services() besluit = self.create_besluit() bio = BesluitInformatieObjectFactory.create(informatieobject=eio_url, besluit=besluit) url = reverse(bio) with capture_on_commit_callbacks(execute=True): response = self.client.delete(url) self.assertEqual(response.status_code, status.HTTP_204_NO_CONTENT) self.assertEqual(StatusLog.objects.count(), 1) logged_warning = StatusLog.objects.get() failed = FailedNotification.objects.get() message = { "aanmaakdatum": "2019-01-01T12:00:00Z", "actie": "destroy", "hoofdObject": f"http://testserver{reverse(bio.besluit)}", "kanaal": "besluiten", "kenmerken": { "verantwoordelijkeOrganisatie": bio.besluit.verantwoordelijke_organisatie, "besluittype": f"http://testserver{reverse(bio.besluit.besluittype)}", }, "resource": "besluitinformatieobject", "resourceUrl": f"http://testserver{url}", } self.assertEqual(failed.statuslog_ptr, logged_warning) self.assertEqual(failed.message, message)
def test_registratiedatum_ignored(self): zaak = ZaakFactory.create() zaak_url = reverse(zaak) io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = reverse(io) ZaakTypeInformatieObjectTypeFactory.create( informatieobjecttype=io.informatieobjecttype, zaaktype=zaak.zaaktype) content = { "informatieobject": f"http://testserver{io_url}", "zaak": f"http://testserver{zaak_url}", "registratiedatum": "2018-09-19T12:25:20+0200", } # Send to the API self.client.post(self.list_url, content) oio = ZaakInformatieObject.objects.get() self.assertEqual( oio.registratiedatum, datetime(2018, 9, 20, 12, 0, 0).replace(tzinfo=timezone.utc), )
def test_duplicate_object(self): """ Test the (informatieobject, object) unique together validation. """ io = EnkelvoudigInformatieObjectFactory.create() io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) bio = BesluitInformatieObjectFactory.create(informatieobject=io_url) besluit_url = reverse(bio.besluit) content = { "informatieobject": io_url, "besluit": f"http://testserver{besluit_url}", } # Send to the API response = self.client.post(self.list_url, content) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST, response.data) error = get_validation_errors(response, "nonFieldErrors") self.assertEqual(error["code"], "unique")
def test_create_besluitinformatieobject_audittrail(self): besluit_data = self._create_besluit() besluit = Besluit.objects.get() eio = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) eio_url = f"http://testserver{reverse(eio)}" self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) besluit.besluittype.informatieobjecttypen.add(eio.informatieobjecttype) url = reverse(BesluitInformatieObject) response = self.client.post( url, { "besluit": besluit_data["url"], "informatieobject": eio_url, }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED) besluitinformatieobject_response = response.data audittrails = AuditTrail.objects.filter( hoofd_object=besluit_data["url"]) self.assertEqual(audittrails.count(), 2) # Verify that the audittrail for the BesluitInformatieObject creation # contains the correct information bio_create_audittrail = audittrails[1] self.assertEqual(bio_create_audittrail.bron, "BRC") self.assertEqual(bio_create_audittrail.actie, "create") self.assertEqual(bio_create_audittrail.resultaat, 201) self.assertEqual(bio_create_audittrail.oud, None) self.assertEqual(bio_create_audittrail.nieuw, besluitinformatieobject_response)
def test_informatieobject_create(self): site = Site.objects.get_current() self.create_zaak_besluit_services() zaak = self.create_zaak() zaak_url = reverse(zaak) io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = f"http://testserver{reverse(io)}" self.adapter.get(io_url, json=serialise_eio(io, io_url)) ZaakTypeInformatieObjectTypeFactory.create( informatieobjecttype=io.informatieobjecttype, zaaktype=zaak.zaaktype) url = reverse(ZaakInformatieObject) response = self.client.post( url, { "zaak": f"http://{site.domain}{zaak_url}", "informatieobject": io_url, }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
def test_update_besluit(self): bio = BesluitInformatieObjectFactory.create() bio_detail_url = reverse(bio) besluit = BesluitFactory.create() besluit_url = reverse(besluit) io = EnkelvoudigInformatieObjectFactory.create() io_url = reverse(io) response = self.client.patch( bio_detail_url, { "besluit": f"http://testserver{besluit_url}", "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, response.data ) for field in ["besluit", "informatieobject"]: with self.subTest(field=field): error = get_validation_errors(response, field) self.assertEqual(error["code"], IsImmutableValidator.code)
def test_us162_voeg_besluit_toe_aan_zaak(self): zaak = ZaakFactory.create(zaaktype__concept=False) zaak_url = reverse(zaak) besluittype = BesluitTypeFactory.create(concept=False) besluittype_url = reverse(besluittype) besluittype.zaaktypen.add(zaak.zaaktype) io = EnkelvoudigInformatieObjectFactory.create( informatieobjecttype__concept=False) io_url = reverse(io) self.adapter.get(io_url, json=serialise_eio(io, io_url)) besluittype.informatieobjecttypen.add(io.informatieobjecttype) with self.subTest(part="besluit_create"): url = get_operation_url("besluit_create") response = self.client.post( url, { "verantwoordelijke_organisatie": "517439943", # RSIN "identificatie": "123123", "besluittype": f"http://testserver{besluittype_url}", "zaak": f"http://testserver{zaak_url}", "datum": "2018-09-06", "toelichting": "Vergunning verleend.", "ingangsdatum": "2018-10-01", "vervaldatum": "2018-11-01", "vervalreden": VervalRedenen.tijdelijk, }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.data) self.assertResponseTypes( response.data, ( ("url", str), ("identificatie", str), ("verantwoordelijke_organisatie", str), ("besluittype", str), ("zaak", str), ("datum", str), ("toelichting", str), ("bestuursorgaan", str), ("ingangsdatum", str), ("vervaldatum", str), ("vervalreden", str), ("publicatiedatum", type(None)), ("verzenddatum", type(None)), ("uiterlijke_reactiedatum", type(None)), ), ) self.assertEqual(Besluit.objects.count(), 1) besluit = Besluit.objects.get() self.assertEqual(besluit.verantwoordelijke_organisatie, "517439943") self.assertEqual(besluit.besluittype, besluittype) self.assertEqual(besluit.zaak, zaak) self.assertEqual(besluit.datum, date(2018, 9, 6)) self.assertEqual(besluit.toelichting, "Vergunning verleend.") self.assertEqual(besluit.ingangsdatum, date(2018, 10, 1)) self.assertEqual(besluit.vervaldatum, date(2018, 11, 1)) self.assertEqual(besluit.vervalreden, VervalRedenen.tijdelijk) with self.subTest(part="besluitinformatieobject_create"): url = get_operation_url("besluitinformatieobject_create") response = self.client.post( url, { "besluit": reverse(besluit), "informatieobject": f"http://testserver{io_url}", }, ) self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.data) self.assertResponseTypes(response.data, (("url", str), ("informatieobject", str))) self.assertEqual(besluit.besluitinformatieobject_set.count(), 1) self.assertEqual( besluit.besluitinformatieobject_set.get().informatieobject. uuid, io.uuid)
def setUp(self) -> None: super().setUp() eio = EnkelvoudigInformatieObjectFactory.create() eio_url = eio.get_url() self.adapter.get(eio_url, json=serialise_eio(eio, eio_url)) self.zio = ZaakInformatieObjectFactory.create(informatieobject=eio_url)