예제 #1
0
    def test_list_zaakobject_limited_to_authorized_zaken(self):
        url = reverse("zaakobject-list")
        # must show up
        zaakobject = ZaakObjectFactory.create(
            zaak__zaaktype=self.zaaktype,
            zaak__vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduiding.openbaar,
        )
        # must not show up
        ZaakObjectFactory.create(
            zaak__zaaktype=self.zaaktype,
            zaak__vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduiding.vertrouwelijk,
        )
        # must not show up
        ZaakObjectFactory.create(
            zaak__vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduiding.openbaar
        )

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        response_data = response.json()
        self.assertEqual(len(response_data), 1)
        self.assertEqual(
            response_data[0]["url"], f"http://testserver{reverse(zaakobject)}"
        )
예제 #2
0
    def test_read_zaakobject_without_identificatie(self):
        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object=OBJECT, object_type=ZaakobjectTypes.besluit)
        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": OBJECT,
                "objectType": ZaakobjectTypes.besluit,
                "objectTypeOverige": "",
                "relatieomschrijving": "",
            },
        )
예제 #3
0
    def test_read_zaakobject_overige(self):

        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.overige)
        Overige.objects.create(zaakobject=zaakobject,
                               overige_data={"some_field": "some value"})

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.overige,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "overigeData": {
                        "someField": "some value"
                    }
                },
            },
        )
예제 #4
0
    def test_filter_zaak(self):
        zaakobject1 = ZaakObjectFactory.create()
        zaakobject2 = ZaakObjectFactory.create()
        zaak = zaakobject1.zaak
        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        zaakobject1_url = get_operation_url("zaakobject_read",
                                            uuid=zaakobject1.uuid)
        url = get_operation_url("zaakobject_list")

        response = self.client.get(url, {"zaak": zaak_url})

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(len(data), 1)
        self.assertEqual(data[0]["url"], f"http://testserver{zaakobject1_url}")
예제 #5
0
    def test_filter_object(self):
        zaakobject1 = ZaakObjectFactory.create(
            object="http://example.com/objects/1")
        zaakobject2 = ZaakObjectFactory.create(
            object="http://example.com/objects/2")
        zaakobject1_url = get_operation_url("zaakobject_read",
                                            uuid=zaakobject1.uuid)
        url = get_operation_url("zaakobject_list")

        response = self.client.get(url,
                                   {"object": "http://example.com/objects/1"})

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(len(data), 1)
        self.assertEqual(data[0]["url"], f"http://testserver{zaakobject1_url}")
예제 #6
0
    def test_filter_type(self):
        zaakobject1 = ZaakObjectFactory.create(
            object_type=ZaakobjectTypes.besluit)
        zaakobject2 = ZaakObjectFactory.create(
            object_type=ZaakobjectTypes.adres)
        zaakobject1_url = get_operation_url("zaakobject_read",
                                            uuid=zaakobject1.uuid)
        url = get_operation_url("zaakobject_list")

        response = self.client.get(url,
                                   {"objectType": ZaakobjectTypes.besluit})

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(len(data), 1)
        self.assertEqual(data[0]["url"], f"http://testserver{zaakobject1_url}")
예제 #7
0
    def test_read_zaakobject_huishouden(self):
        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.huishouden)

        huishouden = Huishouden.objects.create(zaakobject=zaakobject,
                                               nummer="123456")
        terreingebouwdobject = TerreinGebouwdObject.objects.create(
            huishouden=huishouden, identificatie="1")
        Adres.objects.create(
            terreingebouwdobject=terreingebouwdobject,
            num_identificatie="1",
            identificatie="a",
            wpl_woonplaats_naam="test city",
            gor_openbare_ruimte_naam="test space",
            huisnummer="11",
            locatie_aanduiding="test",
        )

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.huishouden,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "nummer": "123456",
                    "isGehuisvestIn": {
                        "identificatie": "1",
                        "adresAanduidingGrp": {
                            "numIdentificatie": "1",
                            "oaoIdentificatie": "a",
                            "wplWoonplaatsNaam": "test city",
                            "gorOpenbareRuimteNaam": "test space",
                            "aoaPostcode": "",
                            "aoaHuisnummer": 11,
                            "aoaHuisletter": "",
                            "aoaHuisnummertoevoeging": "",
                            "ogoLocatieAanduiding": "test",
                        },
                    },
                },
            },
        )
예제 #8
0
    def test_read_zaakobject_wozWaarde(self):
        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.woz_waarde)

        woz_warde = WozWaarde.objects.create(zaakobject=zaakobject,
                                             waardepeildatum="2019")

        wozobject = WozObject.objects.create(woz_warde=woz_warde,
                                             woz_object_nummer="1")
        Adres.objects.create(
            wozobject=wozobject,
            identificatie="a",
            wpl_woonplaats_naam="test city",
            gor_openbare_ruimte_naam="test space",
            huisnummer="11",
            locatie_omschrijving="test",
        )

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.woz_waarde,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "waardepeildatum": "2019",
                    "isVoor": {
                        "wozObjectNummer": "1",
                        "aanduidingWozObject": {
                            "aoaIdentificatie": "a",
                            "wplWoonplaatsNaam": "test city",
                            "aoaPostcode": "",
                            "gorOpenbareRuimteNaam": "test space",
                            "aoaHuisnummer": 11,
                            "aoaHuisletter": "",
                            "aoaHuisnummertoevoeging": "",
                            "locatieOmschrijving": "test",
                        },
                    },
                },
            },
        )
예제 #9
0
    def test_add_resultaat_on_zaak_with_zaakobject_causes_archiefactiedatum_to_be_set(
            self):
        """
        Add RESULTAAT that causes `archiefactiedatum` to be set.
        """
        zaak = ZaakFactory.create()
        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        zaak_object = ZaakObjectFactory.create(zaak=zaak)
        resultaattype = ResultaatTypeFactory.create(
            archiefactietermijn="P10Y",
            archiefnominatie=Archiefnominatie.blijvend_bewaren,
            brondatum_archiefprocedure_afleidingswijze=
            BrondatumArchiefprocedureAfleidingswijze.zaakobject,
            brondatum_archiefprocedure_datumkenmerk="einddatum",
            brondatum_archiefprocedure_objecttype=zaak_object.object_type,
            zaaktype=zaak.zaaktype,
        )
        resultaattype_url = reverse(resultaattype)
        responses = {
            zaak_object.object: {
                "einddatum": isodatetime(2019, 1, 1)
            }
        }

        # add resultaat
        resultaat_create_url = get_operation_url("resultaat_create")
        data = {
            "zaak": zaak_url,
            "resultaattype": resultaattype_url,
            "toelichting": ""
        }

        response = self.client.post(resultaat_create_url, data)

        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.data)

        # add final status to the case to close it and to calculate archive parameters
        status_create_url = get_operation_url("status_create")
        statustype = StatusTypeFactory.create(zaaktype=zaak.zaaktype)
        statustype_url = reverse(statustype)
        data = {
            "zaak": zaak_url,
            "statustype": statustype_url,
            "datumStatusGezet": "2018-10-18T20:00:00Z",
        }

        with mock_client(responses):
            response = self.client.post(status_create_url, data)

        self.assertEqual(response.status_code, status.HTTP_201_CREATED,
                         response.data)

        zaak.refresh_from_db()
        self.assertEqual(zaak.archiefactiedatum, date(2029, 1, 1))
예제 #10
0
    def test_cannot_read_without_correct_scope(self):
        zaak = ZaakFactory.create()
        status = StatusFactory.create()
        zaak_object = ZaakObjectFactory.create()
        resultaat = ResultaatFactory.create()
        urls = [
            reverse("zaak-list"),
            reverse(zaak),
            reverse("status-list"),
            reverse(status),
            reverse("resultaat-list"),
            reverse(resultaat),
            reverse("zaakobject-list"),
            reverse(zaak_object),
        ]

        for url in urls:
            with self.subTest(url=url):
                self.assertForbidden(url, method="get", request_kwargs=ZAAK_READ_KWARGS)
예제 #11
0
    def test_read_zaakobject_adres(self):

        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.adres)
        Adres.objects.create(
            zaakobject=zaakobject,
            identificatie="123456",
            wpl_woonplaats_naam="test city",
            gor_openbare_ruimte_naam="test space",
            huisnummer=1,
        )

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.adres,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "identificatie": "123456",
                    "wplWoonplaatsNaam": "test city",
                    "gorOpenbareRuimteNaam": "test space",
                    "huisnummer": 1,
                    "huisletter": "",
                    "huisnummertoevoeging": "",
                    "postcode": "",
                },
            },
        )
예제 #12
0
    def test_read_zaakobject_medewerker(self):
        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.medewerker)
        Medewerker.objects.create(
            zaakobject=zaakobject,
            identificatie="123456",
            achternaam="Jong",
            voorletters="J",
            voorvoegsel_achternaam="van",
        )

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.medewerker,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "identificatie": "123456",
                    "achternaam": "Jong",
                    "voorletters": "J",
                    "voorvoegselAchternaam": "van",
                },
            },
        )
예제 #13
0
    def test_read_zaakobject_zakelijkRecht(self):
        zaak = ZaakFactory.create()
        zaakobject = ZaakObjectFactory.create(
            zaak=zaak, object="", object_type=ZaakobjectTypes.zakelijk_recht)

        zakelijk_recht = ZakelijkRecht.objects.create(zaakobject=zaakobject,
                                                      identificatie="12345",
                                                      avg_aard="test")

        KadastraleOnroerendeZaak.objects.create(
            zakelijk_recht=zakelijk_recht,
            kadastrale_identificatie="1",
            kadastrale_aanduiding="test",
        )

        heeft_als_gerechtigde = ZakelijkRechtHeeftAlsGerechtigde.objects.create(
            zakelijk_recht=zakelijk_recht)
        NatuurlijkPersoon.objects.create(
            zakelijk_rechtHeeft_als_gerechtigde=heeft_als_gerechtigde,
            anp_identificatie="12345",
            inp_a_nummer="1234567890",
        )
        NietNatuurlijkPersoon.objects.create(
            zakelijk_rechtHeeft_als_gerechtigde=heeft_als_gerechtigde,
            ann_identificatie="123456",
        )

        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("zaakobject_read", uuid=zaakobject.uuid)

        response = self.client.get(url)

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        data = response.json()

        self.assertEqual(
            data,
            {
                "url": f"http://testserver{url}",
                "uuid": str(zaakobject.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "object": "",
                "relatieomschrijving": "",
                "objectType": ZaakobjectTypes.zakelijk_recht,
                "objectTypeOverige": "",
                "objectIdentificatie": {
                    "identificatie": "12345",
                    "avgAard": "test",
                    "heeftBetrekkingOp": {
                        "kadastraleIdentificatie": "1",
                        "kadastraleAanduiding": "test",
                    },
                    "heeftAlsGerechtigde": {
                        "natuurlijkPersoon": {
                            "inpBsn": "",
                            "anpIdentificatie": "12345",
                            "inpA_nummer": "1234567890",
                            "geslachtsnaam": "",
                            "voorvoegselGeslachtsnaam": "",
                            "voorletters": "",
                            "voornamen": "",
                            "geslachtsaanduiding": "",
                            "geboortedatum": "",
                            "verblijfsadres": None,
                            "subVerblijfBuitenland": None,
                        },
                        "nietNatuurlijkPersoon": {
                            "innNnpId": "",
                            "annIdentificatie": "123456",
                            "statutaireNaam": "",
                            "innRechtsvorm": "",
                            "bezoekadres": "",
                            "subVerblijfBuitenland": None,
                        },
                    },
                },
            },
        )