Skip to content

Commit

Permalink
✅ [#2177] Added test for importing map components
Browse files Browse the repository at this point in the history
Map component that don't have interactions configuration, will receive the default config when importing using the migration_converters
  • Loading branch information
robinmolen committed Jan 15, 2025
1 parent 40dbc55 commit d8451a5
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/openforms/forms/tests/test_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,65 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
)
self.assertIsInstance(fixed_components[10]["conditional"]["eq"], int)

def test_import_applies_converters_map_component_interactions(self):
form = FormFactory.create(
generate_minimal_setup=True,
formstep__form_definition__configuration={
"components": [
{
"key": "mapWithoutInteractions",
"type": "map",
"label": "Map",
"useConfigDefaultMapSettings": True,
},
{
"key": "mapWithInteractions",
"type": "map",
"label": "Map",
"useConfigDefaultMapSettings": True,
"interactions": {
"marker": False,
"polygon": True,
"polyline": True,
},
},
]
},
)
call_command("export", form.pk, self.filepath)
call_command("import", import_file=self.filepath)

imported_form = Form.objects.exclude(pk=form.pk).get()
fd = imported_form.formstep_set.get().form_definition

self.assertEqual(
fd.configuration["components"],
[
{
"key": "mapWithoutInteractions",
"type": "map",
"label": "Map",
"useConfigDefaultMapSettings": True,
"interactions": {
"marker": True,
"polygon": False,
"polyline": False,
},
},
{
"key": "mapWithInteractions",
"type": "map",
"label": "Map",
"useConfigDefaultMapSettings": True,
"interactions": {
"marker": False,
"polygon": True,
"polyline": True,
},
},
],
)


class ImportObjectsAPITests(TempdirMixin, OFVCRMixin, TestCase):
"""This test case requires the Objects & Objecttypes API and Open Zaak to be running.
Expand Down

0 comments on commit d8451a5

Please sign in to comment.