Exemplo n.º 1
0
    def test_read_rol_nnp(self):
        zaak = ZaakFactory.create()
        rol = RolFactory.create(
            zaak=zaak,
            betrokkene_type=RolTypes.niet_natuurlijk_persoon,
            betrokkene=BETROKKENE,
            rolomschrijving='Beslisser')
        NietNatuurlijkPersoon.objects.create(
            rol=rol,
            nummer_ander_nietnatuurlijk_persoon='123456',
        )
        zaak_url = get_operation_url('zaak_read', uuid=zaak.uuid)
        url = get_operation_url('rol_read', uuid=rol.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}',
                'zaak': f'http://testserver{zaak_url}',
                'betrokkene': BETROKKENE,
                'betrokkeneType': RolTypes.niet_natuurlijk_persoon,
                'rolomschrijving': 'Beslisser',
                'roltoelichting': '',
                'betrokkeneIdentificatie': {
                    'rsin': '',
                    'nummerAnderNietnatuurlijkPersoon': '123456',
                    'statutaireNaam': '',
                    'rechtsvorm': '',
                    'bezoekadres': '',
                    'subVerblijfBuitenland': ''
                }
            })
Exemplo n.º 2
0
    def test_conditional_get_stale(self):
        rol = RolFactory.create(with_etag=True)

        response = self.client.get(reverse(rol), HTTP_IF_NONE_MATCH='"old"')

        self.assertEqual(response.status_code, status.HTTP_200_OK)
Exemplo n.º 3
0
    def test_rol_head_cache_header(self):
        rol = RolFactory.create()

        self.assertHeadHasETag(reverse(rol))
Exemplo n.º 4
0
    def test_rol_get_cache_header(self):
        rol = RolFactory.create()

        response = self.client.get(reverse(rol))

        self.assertHasETag(response)
Exemplo n.º 5
0
    def test_read_rol_np(self):
        zaak = ZaakFactory.create()
        rol = RolFactory.create(
            zaak=zaak,
            betrokkene_type=RolTypes.natuurlijk_persoon,
            betrokkene=
            "http://www.zamora-silva.org/api/betrokkene/8768c581-2817-4fe5-933d-37af92d819dd",
            omschrijving="Beslisser",
            omschrijving_generiek="Beslisser",
            indicatie_machtiging=IndicatieMachtiging.gemachtigde,
        )
        naturlijkperson = NatuurlijkPersoon.objects.create(
            rol=rol, anp_identificatie="12345", inp_a_nummer="1234567890")
        Adres.objects.create(
            natuurlijkpersoon=naturlijkperson,
            identificatie="123",
            postcode="1111",
            wpl_woonplaats_naam="test city",
            gor_openbare_ruimte_naam="test",
            huisnummer=1,
        )
        SubVerblijfBuitenland.objects.create(
            natuurlijkpersoon=naturlijkperson,
            lnd_landcode="UK",
            lnd_landnaam="United Kingdom",
            sub_adres_buitenland_1="some uk adres",
        )
        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("rol_read", uuid=rol.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(rol.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "betrokkene": BETROKKENE,
                "betrokkeneType": RolTypes.natuurlijk_persoon,
                "roltype": rol.roltype,
                "omschrijving": "Beslisser",
                "omschrijvingGeneriek": "Beslisser",
                "roltoelichting": "",
                "registratiedatum": "2018-01-01T00:00:00Z",
                "indicatieMachtiging": "gemachtigde",
                "betrokkeneIdentificatie": {
                    "inpBsn": "",
                    "anpIdentificatie": "12345",
                    "inpA_nummer": "1234567890",
                    "geslachtsnaam": "",
                    "voorvoegselGeslachtsnaam": "",
                    "voorletters": "",
                    "voornamen": "",
                    "geslachtsaanduiding": "",
                    "geboortedatum": "",
                    "verblijfsadres": {
                        "aoaIdentificatie": "123",
                        "wplWoonplaatsNaam": "test city",
                        "gorOpenbareRuimteNaam": "test",
                        "aoaPostcode": "1111",
                        "aoaHuisnummer": 1,
                        "aoaHuisletter": "",
                        "aoaHuisnummertoevoeging": "",
                        "inpLocatiebeschrijving": "",
                    },
                    "subVerblijfBuitenland": {
                        "lndLandcode": "UK",
                        "lndLandnaam": "United Kingdom",
                        "subAdresBuitenland_1": "some uk adres",
                        "subAdresBuitenland_2": "",
                        "subAdresBuitenland_3": "",
                    },
                },
            },
        )
Exemplo n.º 6
0
    def test_read_rol_vestiging(self):
        zaak = ZaakFactory.create()
        rol = RolFactory.create(
            zaak=zaak,
            betrokkene_type=RolTypes.vestiging,
            betrokkene=BETROKKENE,
            omschrijving="Beslisser",
            omschrijving_generiek="Beslisser",
            indicatie_machtiging=IndicatieMachtiging.gemachtigde,
        )
        vestiging = Vestiging.objects.create(rol=rol,
                                             vestigings_nummer="123456")
        Adres.objects.create(
            vestiging=vestiging,
            identificatie="123",
            postcode="1111",
            wpl_woonplaats_naam="test city",
            gor_openbare_ruimte_naam="test",
            huisnummer=1,
        )
        SubVerblijfBuitenland.objects.create(
            vestiging=vestiging,
            lnd_landcode="UK",
            lnd_landnaam="United Kingdom",
            sub_adres_buitenland_1="some uk adres",
        )
        zaak_url = get_operation_url("zaak_read", uuid=zaak.uuid)
        url = get_operation_url("rol_read", uuid=rol.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(rol.uuid),
                "zaak": f"http://testserver{zaak_url}",
                "betrokkene": BETROKKENE,
                "betrokkeneType": RolTypes.vestiging,
                "roltype": rol.roltype,
                "omschrijving": "Beslisser",
                "omschrijvingGeneriek": "Beslisser",
                "roltoelichting": "",
                "registratiedatum": "2018-01-01T00:00:00Z",
                "indicatieMachtiging": "gemachtigde",
                "betrokkeneIdentificatie": {
                    "vestigingsNummer": "123456",
                    "handelsnaam": [],
                    "verblijfsadres": {
                        "aoaIdentificatie": "123",
                        "wplWoonplaatsNaam": "test city",
                        "gorOpenbareRuimteNaam": "test",
                        "aoaPostcode": "1111",
                        "aoaHuisnummer": 1,
                        "aoaHuisletter": "",
                        "aoaHuisnummertoevoeging": "",
                        "inpLocatiebeschrijving": "",
                    },
                    "subVerblijfBuitenland": {
                        "lndLandcode": "UK",
                        "lndLandnaam": "United Kingdom",
                        "subAdresBuitenland_1": "some uk adres",
                        "subAdresBuitenland_2": "",
                        "subAdresBuitenland_3": "",
                    },
                },
            },
        )