-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
677 additions
and
14 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import json | ||
from pathlib import Path | ||
from typing import Literal | ||
from unittest.mock import patch | ||
|
||
from zgw_consumers.constants import APITypes, AuthTypes | ||
|
||
from openforms.contrib.brk.models import BRKConfig | ||
from zgw_consumers_ext.tests.factories import ServiceFactory | ||
|
||
TEST_FILES = Path(__file__).parent.resolve() / "files" | ||
|
||
TestFileNames = Literal[ | ||
"basisprofiel_response.json", | ||
"basisprofiel_response_vve.json", | ||
"zoeken_response.json", | ||
] | ||
|
||
|
||
def load_json_mock(name: TestFileNames): | ||
with (TEST_FILES / name).open("r") as f: | ||
return json.load(f) | ||
|
||
|
||
BRK_SERVICE = ServiceFactory.build( | ||
api_root="http://localhost:8150/", | ||
oas="http://localhost:8150/", # ignored/unused | ||
api_type=APITypes.orc, | ||
auth_type=AuthTypes.api_key, | ||
header_key="apikey", | ||
header_value="l7xx1f2691f2520d487b902f4e0b57a0b197", | ||
) | ||
|
||
|
||
class BRKTestMixin: | ||
|
||
api_root = BRK_SERVICE.api_root | ||
|
||
def setUp(self): | ||
super().setUp() | ||
|
||
patcher = patch( | ||
"openforms.contrib.brk.client.BRKConfig.get_solo", | ||
return_value=BRKConfig(service=BRK_SERVICE), | ||
) | ||
self.config_mock = patcher.start() | ||
self.addCleanup(patcher.stop) |
121 changes: 121 additions & 0 deletions
121
...ests/files/vcr_cassettes/BRKCadastralClientTests/BRKCadastralClientTests.test_client.yaml
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 |
---|---|---|
@@ -0,0 +1,121 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/hal+json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- application/hal+json | ||
User-Agent: | ||
- python-requests/2.31.0 | ||
apikey: | ||
- l7xx1f2691f2520d487b902f4e0b57a0b197 | ||
method: GET | ||
uri: http://localhost:8150/kadastraalonroerendezaken?postcode=1234AA&huisnummer=123 | ||
response: | ||
body: | ||
string: '{"_links": {"self": {"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}}, "_embedded": {"kadastraalOnroerendeZaken": | ||
[{"identificatie": "cadastral_id", "domein": "string", "indicatieVervallen": | ||
true, "begrenzingPerceel": {"type": "Polygon", "coordinates": [[[0, 0], [0, | ||
0], [0, 0], [0, 0]]]}, "perceelnummerRotatie": 999, "plaatscoordinaten": {"type": | ||
"Point", "coordinates": [0, 0]}, "koopsom": {"koopsom": 0, "koopjaar": 0, | ||
"indicatieMetMeerObjectenVerkregen": true}, "toelichtingBewaarder": "string", | ||
"type": "appartementsrecht", "aardCultuurBebouwd": {"code": "string", "waarde": | ||
"string"}, "aardCultuurOnbebouwd": {"code": "string", "waarde": "string"}, | ||
"kadastraleAanduiding": "string", "kadastraleGrootte": {"soortGrootte": {"code": | ||
"string", "waarde": "string"}, "waarde": 0}, "perceelnummerVerschuiving": | ||
{"deltax": 0, "deltay": 0}, "adressen": [{"straat": "Laan van de landinrichtingscommissie | ||
Duiven-Westervoort", "huisnummer": 1, "huisletter": "A", "huisnummertoevoeging": | ||
"bis", "postcode": "6922KZ", "woonplaats": "Duiven", "nummeraanduidingIdentificatie": | ||
"1234207890123456", "adresregel1": "Ln vd l D-Westervoort 1A-bis", "adresregel2": | ||
"6922KZ Duiven", "adresregel3": "Selangor", "land": {"code": "string", "waarde": | ||
"string"}, "koppelingswijze": {"code": "string", "waarde": "string"}, "adresseerbaarObjectIdentificatie": | ||
"string"}], "gesplitstZakelijkRecht": "beklemrechthouder", "zakelijkGerechtigdeIdentificaties": | ||
["string"], "privaatrechtelijkeBeperkingIdentificaties": ["string"], "hypotheekIdentificaties": | ||
["string"], "beslagIdentificaties": ["string"], "isOvergegaanIn": {"aard": | ||
{"code": "string", "waarde": "string"}, "kadastraalOnroerendeZaken": [{"identificatie": | ||
"string"}]}, "isOntstaanUit": {"aard": {"code": "string", "waarde": "string"}, | ||
"kadastraalOnroerendeZaken": [{"identificatie": "string"}]}, "bijbehorendeGrondpercelen": | ||
[{"identificatie": "string"}], "bijbehorendeAppartementsrechten": [{"identificatie": | ||
"string", "volgnummer": 0, "indicatieSluimerend": true}], "isVermeldInStukdeelIdentificaties": | ||
["string"], "stukIdentificaties": ["string"], "indicatieSluimerend": true, | ||
"_links": {"self": {"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "zakelijkGerechtigden": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "privaatrechtelijkeBeperkingen": [{"href": | ||
"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "hypotheken": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "isOntstaanUit": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "isOvergegaanIn": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "beslagen": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "stukken": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "stukdelen": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "adressen": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "adresseerbareObjecten": [{"href": | ||
"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "bijbehorendeGrondpercelen": [{"href": | ||
"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "bijbehorendeAppartementsrechten": | ||
[{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}]}, "_embedded": {"zakelijkGerechtigden": | ||
[{"identificatie": "string", "type": "beklemrechthouder", "aanvangsdatum": | ||
"2023-11-29", "erfpachtCanon": {"soortErfpachtCanon": {"code": "string", "waarde": | ||
"string"}, "jaarlijksBedrag": {"som": 0, "valuta": {"code": "string", "waarde": | ||
"string"}}, "betrefMeerOnroerendeZaken": true, "einddatumAfkoop": "2023-11-29", | ||
"indicatieOudeOnroerendeZaakBetrokken": true, "isGebaseerdOpStukdeelIdentificatie": | ||
"string", "isVermeldInStukdeelIdentificaties": ["string"], "stukIdentificaties": | ||
["string"]}, "tenaamstelling": {"aandeel": {"noemer": 2, "teller": 1}, "burgerlijkeStaatTenTijdeVanVerkrijging": | ||
{"code": "string", "waarde": "string"}, "verkregenNamensSamenwerkingsverband": | ||
{"code": "string", "waarde": "string"}, "aantekeningen": [{"aard": {"code": | ||
"string", "waarde": "string"}, "omschrijving": "string", "identificatie": | ||
"string", "domein": "string", "einddatum": "2023-11-29", "einddatumRecht": | ||
"2023-11-29", "stukIdentificaties": ["string"], "isGebaseerdOpStukdeelIdentificatie": | ||
"string", "isVermeldInStukdeelIdentificaties": ["string"]}], "gezamenlijkAandeel": | ||
{"noemer": 2, "teller": 1}, "betrokkenPartner": {"identificatie": "string", | ||
"omschrijving": "string", "type": "ingeschreven_natuurlijk_persoon"}, "betrokkenSamenwerkingsverband": | ||
{"identificatie": "string", "omschrijving": "string", "type": "ingeschreven_niet_natuurlijk_persoon"}, | ||
"betrokkenGorzenEnAanwassen": {"identificatie": "string", "omschrijving": | ||
"string", "type": "ingeschreven_niet_natuurlijk_persoon"}, "isGebaseerdOpStukdeelIdentificaties": | ||
["string"], "isVermeldInStukdeelIdentificaties": ["string"], "stukIdentificaties": | ||
["string"]}, "zakelijkRecht": {"stukIdentificaties": ["string"], "isGebaseerdOpStukdeelIdentificaties": | ||
["string"], "isVermeldInStukdeelIdentificaties": ["string"]}, "persoon": {"identificatie": | ||
"string", "omschrijving": "string", "type": "ingeschreven_natuurlijk_persoon"}, | ||
"_links": {"self": {"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "persoon": {"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "betrokkenPartner": {"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "betrokkenSamenwerkingsverband": {"href": | ||
"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "betrokkenGorzenEnAanwassen": {"href": | ||
"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "stukken": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "stukdelen": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}]}}], "privaatrechtelijkeBeperkingen": | ||
[{"aard": {"code": "string", "waarde": "string"}, "omschrijving": "string", | ||
"identificatie": "string", "domein": "string", "einddatum": "2023-11-29", | ||
"einddatumRecht": "2023-11-29", "stukIdentificaties": ["string"], "isGebaseerdOpStukdeelIdentificatie": | ||
"string", "isVermeldInStukdeelIdentificaties": ["string"], "_links": {"self": | ||
{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}, "stukken": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}], "stukdelen": [{"href": "https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}", | ||
"templated": true, "title": "string"}]}}]}}]}}' | ||
headers: | ||
Content-Length: | ||
- '8344' | ||
Content-Type: | ||
- application/json; charset=utf-8 | ||
Date: | ||
- Tue, 05 Dec 2023 15:59:42 GMT | ||
Server: | ||
- Python/3.11 aiohttp/3.9.1 | ||
access-control-allow-methods: | ||
- GET,HEAD,POST,PUT,PATCH,DELETE | ||
access-control-allow-origin: | ||
- '*' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
34 changes: 34 additions & 0 deletions
34
.../files/vcr_cassettes/BRKCadastralClientTests/BRKCadastralClientTests.test_client_404.yaml
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/hal+json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- application/hal+json | ||
User-Agent: | ||
- python-requests/2.31.0 | ||
apikey: | ||
- l7xx1f2691f2520d487b902f4e0b57a0b197 | ||
method: GET | ||
uri: http://localhost:8150/kadastraalonroerendezaken?postcode=dummy&huisnummer=dummy | ||
response: | ||
body: | ||
string: '{"detail":"Not Found"}' | ||
headers: | ||
content-length: | ||
- '22' | ||
content-type: | ||
- application/json | ||
date: | ||
- Tue, 05 Dec 2023 16:09:34 GMT | ||
server: | ||
- uvicorn | ||
status: | ||
code: 404 | ||
message: Not Found | ||
version: 1 |
34 changes: 34 additions & 0 deletions
34
...iles/vcr_cassettes/BRKTitleholdersClientTests/BRKTitleholdersClientTests.test_client.yaml
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/hal+json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- application/hal+json | ||
User-Agent: | ||
- python-requests/2.31.0 | ||
apikey: | ||
- l7xx1f2691f2520d487b902f4e0b57a0b197 | ||
method: GET | ||
uri: http://localhost:8150/kadastraalonroerendezaken/cadastral_id/zakelijkgerechtigden | ||
response: | ||
body: | ||
string: '{"_links":{"self":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"kadastraalOnroerendeZakenUitSplitsing":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"kadastraalOnroerendeZakenUitSplitsingInclusiefZakelijkGerechtigden":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"}},"_embedded":{"zakelijkGerechtigden":[{"identificatie":"string","type":"beklemrechthouder","aanvangsdatum":"2023-11-29","erfpachtCanon":{"soortErfpachtCanon":{"code":"string","waarde":"string"},"jaarlijksBedrag":{"som":0,"valuta":{"code":"string","waarde":"string"}},"betrefMeerOnroerendeZaken":true,"einddatumAfkoop":"2023-11-29","indicatieOudeOnroerendeZaakBetrokken":true,"isGebaseerdOpStukdeelIdentificatie":"string","isVermeldInStukdeelIdentificaties":["string"],"stukIdentificaties":["string"]},"tenaamstelling":{"aandeel":{"noemer":2,"teller":1},"burgerlijkeStaatTenTijdeVanVerkrijging":{"code":"string","waarde":"string"},"verkregenNamensSamenwerkingsverband":{"code":"string","waarde":"string"},"aantekeningen":[{"aard":{"code":"string","waarde":"string"},"omschrijving":"string","identificatie":"string","domein":"string","einddatum":"2023-11-29","einddatumRecht":"2023-11-29","stukIdentificaties":["string"],"isGebaseerdOpStukdeelIdentificatie":"string","isVermeldInStukdeelIdentificaties":["string"]}],"gezamenlijkAandeel":{"noemer":2,"teller":1},"betrokkenPartner":{"identificatie":"string","omschrijving":"string","type":"ingeschreven_natuurlijk_persoon"},"betrokkenSamenwerkingsverband":{"identificatie":"string","omschrijving":"string","type":"ingeschreven_niet_natuurlijk_persoon"},"betrokkenGorzenEnAanwassen":{"identificatie":"string","omschrijving":"string","type":"ingeschreven_niet_natuurlijk_persoon"},"isGebaseerdOpStukdeelIdentificaties":["string"],"isVermeldInStukdeelIdentificaties":["string"],"stukIdentificaties":["string"]},"zakelijkRecht":{"stukIdentificaties":["string"],"isGebaseerdOpStukdeelIdentificaties":["string"],"isVermeldInStukdeelIdentificaties":["string"]},"persoon":{"identificatie":"123456789","omschrijving":"string","type":"ingeschreven_natuurlijk_persoon"},"_links":{"self":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"persoon":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"betrokkenPartner":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"betrokkenSamenwerkingsverband":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"betrokkenGorzenEnAanwassen":{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"},"stukken":[{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"}],"stukdelen":[{"href":"https://datapunt.voorbeeldgemeente.nl/api/v{major-versie}/resourcename/{resource-identificatie}","templated":true,"title":"string"}]}}]},"gesplitstZakelijkRecht":"string"}' | ||
headers: | ||
content-length: | ||
- '3513' | ||
content-type: | ||
- application/json | ||
date: | ||
- Tue, 05 Dec 2023 16:29:54 GMT | ||
server: | ||
- uvicorn | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
34 changes: 34 additions & 0 deletions
34
.../vcr_cassettes/BRKTitleholdersClientTests/BRKTitleholdersClientTests.test_client_404.yaml
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/hal+json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Type: | ||
- application/hal+json | ||
User-Agent: | ||
- python-requests/2.31.0 | ||
apikey: | ||
- l7xx1f2691f2520d487b902f4e0b57a0b197 | ||
method: GET | ||
uri: http://localhost:8150/kadastraalonroerendezaken/dummy/zakelijkgerechtigden | ||
response: | ||
body: | ||
string: '{"detail":"Not Found"}' | ||
headers: | ||
content-length: | ||
- '22' | ||
content-type: | ||
- application/json | ||
date: | ||
- Tue, 05 Dec 2023 16:30:50 GMT | ||
server: | ||
- uvicorn | ||
status: | ||
code: 404 | ||
message: Not Found | ||
version: 1 |
Oops, something went wrong.