1
1
import os
2
-
3
2
from io import StringIO
4
3
from pathlib import Path
5
4
11
10
from vcr .unittest import VCRMixin
12
11
from vng_api_common .tests import reverse
13
12
14
- from openklant .components .klantinteracties .models .digitaal_adres import DigitaalAdres
15
13
from openklant .components .klantinteracties .models .constants import SoortPartij
16
- from openklant .components .klantinteracties .models .partijen import Partij , Persoon , Organisatie
14
+ from openklant .components .klantinteracties .models .digitaal_adres import DigitaalAdres
15
+ from openklant .components .klantinteracties .models .partijen import (
16
+ Organisatie ,
17
+ Partij ,
18
+ Persoon ,
19
+ )
17
20
18
21
19
22
class MigrateTestCase (VCRMixin , LiveServerTestCase ):
@@ -41,7 +44,7 @@ def _get_vcr_kwargs(self, **kwargs) -> dict:
41
44
decode_compressed_response = True ,
42
45
filter_headers = ["authorization" ],
43
46
ignore_hosts = ["localhost" ],
44
- ** kwargs
47
+ ** kwargs ,
45
48
)
46
49
47
50
def _get_partij_url (self , partij ) -> str :
@@ -62,7 +65,7 @@ def test_single_run(self):
62
65
"migrate_to_v2" ,
63
66
"http://127.0.0.1:8001" ,
64
67
self .live_server_url ,
65
- stdout = stdout
68
+ stdout = stdout ,
66
69
)
67
70
68
71
partij = Partij .objects .get ()
@@ -83,7 +86,7 @@ def test_pagination(self):
83
86
"migrate_to_v2" ,
84
87
"http://127.0.0.1:8001" ,
85
88
self .live_server_url ,
86
- stdout = stdout
89
+ stdout = stdout ,
87
90
)
88
91
89
92
partijen = Partij .objects .all ()
@@ -106,7 +109,7 @@ def test_natuurlijk_persoon(self):
106
109
"migrate_to_v2" ,
107
110
"http://127.0.0.1:8001" ,
108
111
self .live_server_url ,
109
- stdout = stdout
112
+ stdout = stdout ,
110
113
)
111
114
112
115
partij = Partij .objects .get ()
@@ -144,7 +147,7 @@ def test_niet_natuurlijk_persoon(self):
144
147
"migrate_to_v2" ,
145
148
"http://127.0.0.1:8001" ,
146
149
self .live_server_url ,
147
- stdout = stdout
150
+ stdout = stdout ,
148
151
)
149
152
150
153
partij = Partij .objects .get ()
@@ -179,7 +182,7 @@ def test_vestiging(self):
179
182
"migrate_to_v2" ,
180
183
"http://127.0.0.1:8001" ,
181
184
self .live_server_url ,
182
- stdout = stdout
185
+ stdout = stdout ,
183
186
)
184
187
185
188
partij = Partij .objects .get ()
@@ -214,7 +217,7 @@ def test_no_subject_and_subject_identificatie(self):
214
217
"migrate_to_v2" ,
215
218
"http://127.0.0.1:8001" ,
216
219
self .live_server_url ,
217
- stdout = stdout
220
+ stdout = stdout ,
218
221
)
219
222
220
223
partij = Partij .objects .get ()
@@ -252,7 +255,7 @@ def test_subject_and_no_subject_identificatie(self):
252
255
"migrate_to_v2" ,
253
256
"http://127.0.0.1:8001" ,
254
257
self .live_server_url ,
255
- stdout = stdout
258
+ stdout = stdout ,
256
259
)
257
260
258
261
partij = Partij .objects .get ()
@@ -290,7 +293,7 @@ def test_no_subject_and_no_subject_identificatie(self):
290
293
"migrate_to_v2" ,
291
294
"http://127.0.0.1:8001" ,
292
295
self .live_server_url ,
293
- stdout = stdout
296
+ stdout = stdout ,
294
297
)
295
298
296
299
self .assertEqual (Partij .objects .count (), 0 )
@@ -306,7 +309,7 @@ def test_incorrect_subject_identificatie(self):
306
309
"migrate_to_v2" ,
307
310
"http://127.0.0.1:8001" ,
308
311
self .live_server_url ,
309
- stdout = stdout
312
+ stdout = stdout ,
310
313
)
311
314
312
315
self .assertEqual (Partij .objects .count (), 0 )
@@ -322,7 +325,7 @@ def test_incorrect_subject_url(self):
322
325
"migrate_to_v2" ,
323
326
"http://127.0.0.1:8001" ,
324
327
self .live_server_url ,
325
- stdout = stdout
328
+ stdout = stdout ,
326
329
)
327
330
328
331
self .assertEqual (Partij .objects .count (), 0 )
@@ -338,7 +341,7 @@ def test_subject_404(self):
338
341
"migrate_to_v2" ,
339
342
"http://127.0.0.1:8001" ,
340
343
self .live_server_url ,
341
- stdout = stdout
344
+ stdout = stdout ,
342
345
)
343
346
344
347
self .assertEqual (Partij .objects .count (), 0 )
@@ -354,7 +357,7 @@ def test_digitaal_adres(self):
354
357
"migrate_to_v2" ,
355
358
"http://127.0.0.1:8001" ,
356
359
self .live_server_url ,
357
- stdout = stdout
360
+ stdout = stdout ,
358
361
)
359
362
360
363
partij = Partij .objects .get ()
@@ -397,7 +400,7 @@ def test_no_access_token(self):
397
400
"migrate_to_v2" ,
398
401
"http://127.0.0.1:8001" ,
399
402
self .live_server_url ,
400
- stdout = stdout
403
+ stdout = stdout ,
401
404
)
402
405
403
406
self .assertEqual (Partij .objects .count (), 0 )
@@ -413,7 +416,7 @@ def test_no_subject_type(self):
413
416
"migrate_to_v2" ,
414
417
"http://127.0.0.1:8001" ,
415
418
self .live_server_url ,
416
- stdout = stdout
419
+ stdout = stdout ,
417
420
)
418
421
419
422
self .assertEqual (Partij .objects .count (), 0 )
@@ -425,12 +428,7 @@ def test_no_subject_type(self):
425
428
def test_invalid_urls (self ):
426
429
stdout = StringIO ()
427
430
428
- call_command (
429
- "migrate_to_v2" ,
430
- "foobar.com" ,
431
- self .live_server_url ,
432
- stdout = stdout
433
- )
431
+ call_command ("migrate_to_v2" , "foobar.com" , self .live_server_url , stdout = stdout )
434
432
435
433
self .assertEqual (Partij .objects .count (), 0 )
436
434
0 commit comments