diff --git a/catalystwan/tests/config_migration/policy_converters/test_references_updater.py b/catalystwan/tests/config_migration/policy_converters/test_references_updater.py index 9dc32611..bf196a92 100644 --- a/catalystwan/tests/config_migration/policy_converters/test_references_updater.py +++ b/catalystwan/tests/config_migration/policy_converters/test_references_updater.py @@ -57,4 +57,4 @@ def test_not_update_parcel_references(self): updated_parcel = update_parcel_references(aip_parcel, pushed_objects) - assert updated_parcel is aip_parcel + assert updated_parcel.model_dump_json() == aip_parcel.model_dump_json() diff --git a/catalystwan/utils/config_migration/creators/references_updater.py b/catalystwan/utils/config_migration/creators/references_updater.py index 940246b6..34759386 100644 --- a/catalystwan/utils/config_migration/creators/references_updater.py +++ b/catalystwan/utils/config_migration/creators/references_updater.py @@ -10,6 +10,11 @@ def update_parcel_references(parcel: T, uuid_map: Dict[UUID, UUID]) -> T: + """ + Replaces UUID strings found in json dump based on provided map + always returns a copy of original even when there was no substitution + always perform output validation + """ target_dump = parcel.model_dump_json(by_alias=True) pattern = '"{}"'