Skip to content

Commit

Permalink
✅ [#4659] Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Oct 10, 2024
1 parent fe910bb commit 5710b49
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/openforms/appointments/tests/test_confirmation_emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
register = Registry()

LAST_NAME: Component = {
"defaultValue": "",
"type": "textfield",
"key": "lastName",
"label": "Last name",
Expand All @@ -36,6 +37,7 @@
}

EMAIL: Component = {
"defaultValue": "",
"type": "email",
"key": "email",
"label": "Email",
Expand Down
7 changes: 7 additions & 0 deletions src/openforms/appointments/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ def test_appointment_step_not_applicable(self):
"display": "form",
"components": [
{
"defaultValue": "",
"key": "product",
"type": "textfield",
"appointments": {"showProducts": True},
"label": "Product",
},
{
"defaultValue": "",
"key": "location",
"type": "textfield",
"appointments": {"showLocations": True},
Expand Down Expand Up @@ -97,12 +99,14 @@ def test_creating_appointment_with_missing_or_not_filled_in_appointment_informat
"display": "form",
"components": [
{
"defaultValue": "",
"key": "product",
"type": "textfield",
"appointments": {"showProducts": True},
"label": "Product",
},
{
"defaultValue": "",
"key": "time",
"type": "textfield",
"appointments": {"showTimes": True},
Expand Down Expand Up @@ -185,12 +189,14 @@ def test_creating_appointment_properly_creates_appointment_and_adds_appointment_
"display": "form",
"components": [
{
"defaultValue": "",
"key": "product",
"type": "textfield",
"appointments": {"showProducts": True},
"label": "Product",
},
{
"defaultValue": "",
"key": "location",
"type": "textfield",
"appointments": {"showLocations": True},
Expand All @@ -210,6 +216,7 @@ def test_creating_appointment_properly_creates_appointment_and_adds_appointment_
"display": "form",
"components": [
{
"defaultValue": "",
"key": "lastName",
"type": "textfield",
"appointments": {"lastName": True},
Expand Down
1 change: 1 addition & 0 deletions src/openforms/forms/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class FormDefinitionFactory(factory.django.DjangoModelFactory):
lambda n: {
"components": [
{
"defaultValue": "",
"type": "textfield",
"key": f"test-key-{n}",
"label": f"Test label {n}",
Expand Down
11 changes: 10 additions & 1 deletion src/openforms/forms/tests/test_api_form_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,15 @@ def test_restore_version(self):
self.assertEqual("test-step-1", form_step.slug)
self.assertEqual("test-definition-1", restored_form_definition.slug)
self.assertEqual(
{"components": [{"key": "test", "test": "1", "type": "textfield"}]},
{
"components": [
{
"defaultValue": "",
"key": "test",
"test": "1",
"type": "textfield",
}
]
},
restored_form_definition.configuration,
)
28 changes: 24 additions & 4 deletions src/openforms/forms/tests/test_import_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def test_import(self):
},
)
form_definition = FormDefinitionFactory.create(
configuration={"components": [{"key": "test-key", "type": "textfield"}]}
configuration={"components": [{"defaultValue": "", "key": "test-key", "type": "textfield"}]}
)
form_step = FormStepFactory.create(form=form, form_definition=form_definition)
FormVariableFactory.create(
Expand Down Expand Up @@ -379,7 +379,11 @@ def test_import_form_definition_uuid_already_exists_configuration_duplicate(self
product = ProductFactory.create()
form = FormFactory.create(product=product)
form_definition = FormDefinitionFactory.create(
configuration={"components": [{"key": "test-key", "type": "textfield"}]},
configuration={
"components": [
{"defaultValue": "", "key": "test-key", "type": "textfield"}
]
},
is_reusable=True,
)
form_step = FormStepFactory.create(form=form, form_definition=form_definition)
Expand Down Expand Up @@ -442,7 +446,11 @@ def test_import_form_definition_uuid_already_exists_configuration_different(self
product = ProductFactory.create()
form = FormFactory.create(product=product)
form_definition = FormDefinitionFactory.create(
configuration={"components": [{"key": "test-key", "type": "textfield"}]},
configuration={
"components": [
{"defaultValue": "", "key": "test-key", "type": "textfield"}
]
},
is_reusable=True, # only re-usable FDs may be related to multiple forms
)
form_step = FormStepFactory.create(form=form, form_definition=form_definition)
Expand Down Expand Up @@ -918,6 +926,7 @@ def test_import_form_without_cosign_tag(self):
"configuration": {
"components": [
{
"defaultValue": "",
"key": "textField",
"type": "textfield",
},
Expand Down Expand Up @@ -995,6 +1004,7 @@ def test_import_form_without_cosign_tag_in_one_language(self):
"configuration": {
"components": [
{
"defaultValue": "",
"key": "textField",
"type": "textfield",
},
Expand Down Expand Up @@ -1034,7 +1044,7 @@ def add_foo(component):
generate_minimal_setup=True,
formstep__form_definition__configuration={
"components": [
{"type": "textfield", "key": "textfield"},
{"defaultValue": "", "type": "textfield", "key": "textfield"},
{"type": "nottextfield", "key": "nottextfield"},
]
},
Expand Down Expand Up @@ -1098,6 +1108,7 @@ def test_import_form_with_legacy_formio_component_translations_format(self):
"configuration": {
"components": [
{
"defaultValue": "",
"key": "textfield",
"type": "textfield",
"label": "TEXTFIELD_LABEL",
Expand Down Expand Up @@ -1246,11 +1257,13 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"label": "Currency",
},
{
"defaultValue": "",
"key": "textfield",
"type": "textfield",
"label": "Text Field",
},
{
"defaultValue": "",
"key": "textArea1",
"type": "textarea",
"label": "Text Area 1",
Expand All @@ -1262,6 +1275,7 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"clearOnHide": True,
},
{
"defaultValue": "",
"key": "textArea2",
"type": "textarea",
"label": "Text Area 2",
Expand All @@ -1273,13 +1287,15 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"clearOnHide": True,
},
{
"defaultValue": "",
"key": "textArea3",
"type": "textarea",
"label": "Text Area 3",
"conditional": {"eq": "", "show": None, "when": ""},
"clearOnHide": True,
},
{
"defaultValue": "",
"key": "textArea4",
"type": "textarea",
"label": "Text Area 4",
Expand All @@ -1291,6 +1307,7 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"clearOnHide": True,
},
{
"defaultValue": "",
"key": "textArea5",
"type": "textarea",
"label": "Text Area 5",
Expand All @@ -1302,6 +1319,7 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"clearOnHide": True,
},
{
"defaultValue": "",
"key": "textArea6",
"type": "textarea",
"label": "Text Area 6",
Expand All @@ -1318,6 +1336,7 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
"label": "Repeating group",
"components": [
{
"defaultValue": "",
"key": "textArea7",
"type": "textarea",
"label": "Text Area 7",
Expand All @@ -1331,6 +1350,7 @@ def test_import_form_with_old_simple_conditionals_with_numbers(self):
],
},
{
"defaultValue": "",
"key": "textArea8",
"type": "textarea",
"label": "Text Area 8",
Expand Down
12 changes: 11 additions & 1 deletion src/openforms/forms/tests/test_restore_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,16 @@ def test_restoring_version(self):
)
self.assertEqual("test-definition-1", restored_form_definition.slug)
self.assertEqual(
{"components": [{"test": "1", "key": "test", "type": "textfield"}]},
{
"components": [
{
"defaultValue": "",
"test": "1",
"key": "test",
"type": "textfield",
}
]
},
restored_form_definition.configuration,
)

Expand Down Expand Up @@ -301,6 +310,7 @@ def test_restore_form_with_reusable_form_definition(self):
{
"components": [
{
"defaultValue": "",
"type": "textfield",
"key": "reusable1",
}
Expand Down

0 comments on commit 5710b49

Please sign in to comment.