26
26
27
27
28
28
class ZGWExportImportMockData :
29
- def __init__ (self , count = 0 ):
29
+ def __init__ (self , count = 0 , with_dupes = False ):
30
30
self .original_url = f"https://foo.{ count } .maykinmedia.nl"
31
31
self .original_uuid = "a1591906-3368-470a-a957-4b8634c275a1"
32
32
self .service = ServiceFactory (slug = f"service-{ count } " )
@@ -78,6 +78,14 @@ def __init__(self, count=0):
78
78
omschrijving = "informatieobject" ,
79
79
zaaktype_uuids = [self .original_uuid ],
80
80
)
81
+ if with_dupes :
82
+ self .ztc_resultaat_2 = ZaakTypeResultaatTypeConfigFactory (
83
+ zaaktype_config = self .ztc ,
84
+ resultaattype_url = self .original_url ,
85
+ omschrijving = "status omschrijving" , # test dupes across models
86
+ zaaktype_uuids = [self .original_uuid ],
87
+ description = "" ,
88
+ )
81
89
82
90
83
91
class ExportObjectTests (TestCase ):
@@ -344,6 +352,7 @@ def setUp(self):
344
352
]
345
353
self .json_dupes = [
346
354
'{"model": "openzaak.zaaktypestatustypeconfig", "fields": {"zaaktype_config": ["ztc-id-a-0", "DM-0", "123456789"], "statustype_url": "https://bar.maykinmedia.nl", "omschrijving": "status omschrijving", "statustekst": "statustekst nieuw", "zaaktype_uuids": "[]", "status_indicator": "", "status_indicator_text": "", "document_upload_description": "", "description": "status", "notify_status_change": true, "action_required": false, "document_upload_enabled": true, "call_to_action_url": "", "call_to_action_text": "", "case_link_text": ""}}' ,
355
+ '{"model": "openzaak.zaaktyperesultaattypeconfig", "fields": {"zaaktype_config": ["ztc-id-a-0", "DM-0", "123456789"], "resultaattype_url": "https://bar.maykinmedia.nl", "omschrijving": "status omschrijving", "zaaktype_uuids": "[]", "description": "description new"}}' ,
347
356
]
348
357
self .jsonl = "\n " .join (self .json_lines )
349
358
self .jsonl_with_dupes = "\n " .join (self .json_lines + self .json_dupes )
@@ -557,7 +566,7 @@ def test_import_jsonl_update_reports_duplicate_db_records(self):
557
566
self .assertEqual (import_result , import_expected )
558
567
559
568
def test_import_jsonl_update_reports_duplicate_natural_keys_in_upload_file (self ):
560
- mocks = ZGWExportImportMockData ()
569
+ mocks = ZGWExportImportMockData (with_dupes = True )
561
570
562
571
self .storage .save ("import.jsonl" , io .StringIO (self .jsonl_with_dupes ))
563
572
@@ -574,12 +583,13 @@ def test_import_jsonl_update_reports_duplicate_natural_keys_in_upload_file(self)
574
583
)
575
584
import_expected = dataclasses .asdict (
576
585
ZGWConfigImport (
577
- total_rows_processed = 6 ,
586
+ total_rows_processed = 7 ,
578
587
catalogus_configs_imported = 1 ,
579
588
zaaktype_configs_imported = 1 ,
580
589
zaak_informatie_object_type_configs_imported = 1 ,
581
590
zaak_status_type_configs_imported = 1 ,
582
- zaak_resultaat_type_configs_imported = 1 ,
591
+ # resultaat_type_config with "status omschrijving" should be imported
592
+ zaak_resultaat_type_configs_imported = 2 ,
583
593
import_errors = [expected_error ],
584
594
),
585
595
)
0 commit comments