@@ -98,6 +98,14 @@ def test_read_partij(self):
98
98
def test_create_partij (self ):
99
99
digitaal_adres , digitaal_adres2 = DigitaalAdresFactory .create_batch (2 )
100
100
rekeningnummer , rekeningnummer2 = RekeningnummerFactory .create_batch (2 )
101
+
102
+ partij_identificator = PartijIdentificatorFactory .create (
103
+ partij_identificator_code_objecttype = "natuurlijk_persoon" ,
104
+ partij_identificator_code_soort_object_id = "bsn" ,
105
+ partij_identificator_object_id = "296648875" ,
106
+ partij_identificator_code_register = "brp" ,
107
+ )
108
+
101
109
list_url = reverse ("klantinteracties:partij-list" )
102
110
data = {
103
111
"nummer" : "1298329191" ,
@@ -140,7 +148,10 @@ def test_create_partij(self):
140
148
"objectId" : "296648875" ,
141
149
"codeRegister" : "brp" ,
142
150
},
143
- }
151
+ },
152
+ {
153
+ "uuid" : str (partij_identificator .uuid ),
154
+ },
144
155
],
145
156
}
146
157
@@ -184,6 +195,14 @@ def test_create_partij(self):
184
195
"land" : "6030" ,
185
196
},
186
197
)
198
+ self .assertEqual (len (data ["partijIdentificatoren" ]), 2 )
199
+ self .assertTrue (
200
+ str (partij_identificator .uuid )
201
+ in [
202
+ identificator ["uuid" ] for identificator in data ["partijIdentificatoren" ]
203
+ ]
204
+ )
205
+
187
206
self .assertEqual (
188
207
data ["partijIdentificatoren" ][0 ]["partijIdentificator" ],
189
208
{
@@ -193,6 +212,9 @@ def test_create_partij(self):
193
212
"codeRegister" : "brp" ,
194
213
},
195
214
)
215
+
216
+ data ["partijIdentificatoren" ] = None
217
+
196
218
with self .subTest ("create_partij_without_foreignkey_relations" ):
197
219
data ["nummer" ] = "1298329192"
198
220
data ["digitaleAdressen" ] = []
@@ -886,6 +908,8 @@ def test_update_partij(self):
886
908
},
887
909
)
888
910
911
+ data ["partijIdentificatoren" ] = None
912
+
889
913
with self .subTest (
890
914
"test_voorkeurs_digitaal_adres_must_be_part_of_digitale_adressen"
891
915
):
@@ -2290,7 +2314,7 @@ def test_invalid_validation_partij_identificator_code_objecttype(self):
2290
2314
self .assertEqual (response .data ["title" ], "Invalid input." )
2291
2315
self .assertEqual (
2292
2316
response .data ["invalid_params" ][0 ]["name" ],
2293
- "partijIdentificatorCodeObjecttype" ,
2317
+ "partijIdentificator. partijIdentificatorCodeObjecttype" ,
2294
2318
)
2295
2319
self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid" )
2296
2320
self .assertEqual (
@@ -2318,7 +2342,7 @@ def test_invalid_validation_partij_identificator_code_soort_object_id(self):
2318
2342
self .assertEqual (response .data ["title" ], "Invalid input." )
2319
2343
self .assertEqual (
2320
2344
response .data ["invalid_params" ][0 ]["name" ],
2321
- "partijIdentificatorCodeSoortObjectId" ,
2345
+ "partijIdentificator. partijIdentificatorCodeSoortObjectId" ,
2322
2346
)
2323
2347
self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid" )
2324
2348
self .assertEqual (
@@ -2346,7 +2370,7 @@ def test_invalid_validation_partij_identificator_object_id(self):
2346
2370
self .assertEqual (response .data ["title" ], "Invalid input." )
2347
2371
self .assertEqual (
2348
2372
response .data ["invalid_params" ][0 ]["name" ],
2349
- "partijIdentificatorObjectId" ,
2373
+ "partijIdentificator. partijIdentificatorObjectId" ,
2350
2374
)
2351
2375
self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid" )
2352
2376
self .assertEqual (
@@ -2374,7 +2398,7 @@ def test_invalid_overig_code_objecttype_validation_partij_identificator(self):
2374
2398
self .assertEqual (response .data ["title" ], "Invalid input." )
2375
2399
self .assertEqual (
2376
2400
response .data ["invalid_params" ][0 ]["name" ],
2377
- "partijIdentificatorCodeObjecttype" ,
2401
+ "partijIdentificator. partijIdentificatorCodeObjecttype" ,
2378
2402
)
2379
2403
self .assertEqual (response .data ["invalid_params" ][0 ]["code" ], "invalid" )
2380
2404
self .assertEqual (
@@ -2446,6 +2470,78 @@ def test_valid_overig_code_register_validation_partij_identificator(self):
2446
2470
"overig" ,
2447
2471
)
2448
2472
2473
+ def test_valid_empty_partij_identificator (self ):
2474
+ url = reverse ("klantinteracties:partijidentificator-list" )
2475
+ partij = PartijFactory .create ()
2476
+ data = {
2477
+ "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2478
+ "anderePartijIdentificator" : "anderePartijIdentificator" ,
2479
+ "partijIdentificator" : {},
2480
+ }
2481
+ response = self .client .post (url , data )
2482
+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2483
+ self .assertEqual (
2484
+ response .data ["partij_identificator" ],
2485
+ {
2486
+ "code_objecttype" : "" ,
2487
+ "code_soort_object_id" : "" ,
2488
+ "object_id" : "" ,
2489
+ "code_register" : "" ,
2490
+ },
2491
+ )
2492
+
2493
+ data = {
2494
+ "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2495
+ "anderePartijIdentificator" : "anderePartijIdentificator" ,
2496
+ "partijIdentificator" : None ,
2497
+ }
2498
+ response = self .client .post (url , data )
2499
+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2500
+ self .assertEqual (
2501
+ response .data ["partij_identificator" ],
2502
+ {
2503
+ "code_objecttype" : "" ,
2504
+ "code_soort_object_id" : "" ,
2505
+ "object_id" : "" ,
2506
+ "code_register" : "" ,
2507
+ },
2508
+ )
2509
+
2510
+ data = {
2511
+ "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2512
+ "anderePartijIdentificator" : "anderePartijIdentificator" ,
2513
+ }
2514
+ response = self .client .post (url , data )
2515
+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2516
+ self .assertEqual (
2517
+ response .data ["partij_identificator" ],
2518
+ {
2519
+ "code_objecttype" : "" ,
2520
+ "code_soort_object_id" : "" ,
2521
+ "object_id" : "" ,
2522
+ "code_register" : "" ,
2523
+ },
2524
+ )
2525
+
2526
+ data = {
2527
+ "identificeerdePartij" : {"uuid" : str (partij .uuid )},
2528
+ "anderePartijIdentificator" : "anderePartijIdentificator" ,
2529
+ "partijIdentificator" : {
2530
+ "code_register" : "brp" ,
2531
+ },
2532
+ }
2533
+ response = self .client .post (url , data )
2534
+ self .assertEqual (response .status_code , status .HTTP_201_CREATED )
2535
+ self .assertEqual (
2536
+ response .data ["partij_identificator" ],
2537
+ {
2538
+ "code_objecttype" : "" ,
2539
+ "code_soort_object_id" : "" ,
2540
+ "object_id" : "" ,
2541
+ "code_register" : "brp" ,
2542
+ },
2543
+ )
2544
+
2449
2545
2450
2546
class CategorieRelatieTests (APITestCase ):
2451
2547
def test_list_categorie_relatie (self ):
0 commit comments