From fb8e6dc4c86ce45110ba2f31b22fafcc410eccef Mon Sep 17 00:00:00 2001 From: Viktor van Wijk Date: Fri, 24 Jan 2025 17:36:35 +0100 Subject: [PATCH] :white_check_mark: [#4980] Update tests --- .../tests/test_static_variables.py | 96 +++---- .../tests/test_component_json_schemas.py | 6 +- .../forms/tests/test_form_to_json_schema.py | 203 -------------- src/openforms/forms/tests/test_json_schema.py | 258 ++++++++++++++++++ .../test_variables_in_logic_trigger.py | 8 - .../registrations/contrib/json_dump/plugin.py | 2 + ...ervice_returns_unexpected_status_code.yaml | 9 +- ...ckendTests.test_multiple_file_uploads.yaml | 14 +- ...ackendTests.test_nested_component_key.yaml | 46 ++++ ...e_upload_for_multiple_files_component.yaml | 17 +- ...file_upload_for_single_file_component.yaml | 15 +- ...e_upload_for_multiple_files_component.yaml | 14 +- ...ent_with_form_variable_as_data_source.yaml | 18 +- ...dio_component_with_manual_data_source.yaml | 18 +- ...ent_with_form_variable_as_data_source.yaml | 20 +- ...ed_is_empty_when_no_data_is_submitted.yaml | 16 +- ...ent_with_form_variable_as_data_source.yaml | 18 +- ...ect_component_with_manual_data_source.yaml | 18 +- ...ckendTests.test_submission_happy_flow.yaml | 21 +- .../contrib/json_dump/tests/test_backend.py | 45 ++- .../tests/test_data_type_to_json_schema.py | 23 ++ .../variables/tests/test_registry.py | 4 - .../variables/tests/test_static_variables.py | 39 ++- .../tests/test_user_defined_variables.py | 54 ---- src/openforms/variables/tests/test_views.py | 8 - 25 files changed, 530 insertions(+), 460 deletions(-) delete mode 100644 src/openforms/forms/tests/test_form_to_json_schema.py create mode 100644 src/openforms/forms/tests/test_json_schema.py create mode 100644 src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml create mode 100644 src/openforms/variables/tests/test_data_type_to_json_schema.py delete mode 100644 src/openforms/variables/tests/test_user_defined_variables.py diff --git a/src/openforms/authentication/tests/test_static_variables.py b/src/openforms/authentication/tests/test_static_variables.py index c91afcd614..3a7cb1c737 100644 --- a/src/openforms/authentication/tests/test_static_variables.py +++ b/src/openforms/authentication/tests/test_static_variables.py @@ -5,29 +5,12 @@ from jsonschema.validators import Draft202012Validator from openforms.authentication.constants import AuthAttribute -from openforms.authentication.static_variables.static_variables import ( - Auth, - AuthBSN, - AuthContext, - AuthContextActingSubjectIdentifier, - AuthContextActingSubjectIdentifierType, - AuthContextBranchNumber, - AuthContextLegalSubjectIdentifier, - AuthContextLegalSubjectIdentifierType, - AuthContextLOA, - AuthContextRepresenteeIdentifier, - AuthContextRepresenteeType, - AuthContextSource, - AuthKvK, - AuthPseudo, - AuthType, - LanguageCode, - SubmissionID, -) from openforms.authentication.tests.factories import AuthInfoFactory from openforms.submissions.tests.factories import SubmissionFactory from openforms.variables.service import get_static_variables +from ..static_variables.static_variables import register_static_variable as registry + class TestStaticVariables(TestCase): def test_auth_static_data(self): @@ -157,11 +140,16 @@ def test_branch_number_variable(self): self.assertEqual(static_data["auth_context_branch_number"], expected) +# TODO-4980: move to openforms.utils.json_schema.tests? class StaticVariableValidJsonSchemaTests(TestCase): validator = Draft202012Validator - def check_schema(self, properties): + @staticmethod + def _get_json_schema(key: str): + return registry[key].as_json_schema() + + def assertValidSchema(self, properties): schema = { "$schema": self.validator.META_SCHEMA["$id"], **properties, @@ -170,69 +158,69 @@ def check_schema(self, properties): self.validator.check_schema(schema) def test_submission_id(self): - schema = SubmissionID.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("submission_id") + self.assertValidSchema(schema) def test_language_code(self): - schema = LanguageCode.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("language_code") + self.assertValidSchema(schema) def test_auth(self): - schema = Auth.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth") + self.assertValidSchema(schema) def test_auth_type(self): - schema = AuthType.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_type") + self.assertValidSchema(schema) def test_auth_bsn(self): - schema = AuthBSN.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_bsn") + self.assertValidSchema(schema) def test_auth_kvk(self): - schema = AuthKvK.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_kvk") + self.assertValidSchema(schema) def test_auth_pseudo(self): - schema = AuthPseudo.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_pseudo") + self.assertValidSchema(schema) def test_auth_context(self): - schema = AuthContext.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context") + self.assertValidSchema(schema) def test_auth_context_source(self): - schema = AuthContextSource.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_source") + self.assertValidSchema(schema) def test_auth_context_loa(self): - schema = AuthContextLOA.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_loa") + self.assertValidSchema(schema) def test_auth_context_representee_type(self): - schema = AuthContextRepresenteeType.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_representee_identifier_type") + self.assertValidSchema(schema) def test_auth_context_representee_identifier(self): - schema = AuthContextRepresenteeIdentifier.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_representee_identifier") + self.assertValidSchema(schema) def test_auth_context_legal_subject_identifier_type(self): - schema = AuthContextLegalSubjectIdentifierType.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_legal_subject_identifier_type") + self.assertValidSchema(schema) def test_auth_context_legal_subject_identifier(self): - schema = AuthContextLegalSubjectIdentifier.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_legal_subject_identifier") + self.assertValidSchema(schema) def test_auth_context_branch_number(self): - schema = AuthContextBranchNumber.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_branch_number") + self.assertValidSchema(schema) def test_auth_context_acting_subject_identifier_type(self): - schema = AuthContextActingSubjectIdentifierType.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_acting_subject_identifier_type") + self.assertValidSchema(schema) def test_auth_context_acting_subject_identifier(self): - schema = AuthContextActingSubjectIdentifier.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("auth_context_acting_subject_identifier") + self.assertValidSchema(schema) diff --git a/src/openforms/formio/tests/test_component_json_schemas.py b/src/openforms/formio/tests/test_component_json_schemas.py index eda904fad6..16a743dcff 100644 --- a/src/openforms/formio/tests/test_component_json_schemas.py +++ b/src/openforms/formio/tests/test_component_json_schemas.py @@ -49,7 +49,7 @@ class ComponentValidJsonSchemaTests(TestCase): validator = Draft202012Validator - def check_schema(self, properties): + def assertValidSchema(self, properties): schema = { "$schema": self.validator.META_SCHEMA["$id"], **properties, @@ -61,14 +61,14 @@ def _test_component(self, component_class, component, multiple=False): with self.subTest(f"single {component['label']}"): schema = component_class.as_json_schema(component) - self.check_schema(schema) + self.assertValidSchema(schema) if multiple: with self.subTest(f"multiple {component['label']}"): component["multiple"] = True schema = component_class.as_json_schema(component) - self.check_schema(schema) + self.assertValidSchema(schema) def test_checkbox(self): component_class = Checkbox diff --git a/src/openforms/forms/tests/test_form_to_json_schema.py b/src/openforms/forms/tests/test_form_to_json_schema.py deleted file mode 100644 index 032a4c1a7d..0000000000 --- a/src/openforms/forms/tests/test_form_to_json_schema.py +++ /dev/null @@ -1,203 +0,0 @@ -from django.test import TestCase - -from openforms.forms.tests.factories import ( - FormDefinitionFactory, - FormFactory, - FormStepFactory, - FormVariableFactory, -) -from openforms.forms.utils import ( - form_variables_to_json_schema, - get_json_schema_from_form_variable, - is_form_variable_required, -) -from openforms.variables.constants import FormVariableDataTypes, FormVariableSources - - -class FormToJsonSchemaTestCase(TestCase): - def test_correct_variables_included_in_schema(self): - form = FormFactory.create() - form_def_1 = FormDefinitionFactory.create( - configuration={ - "components": [ - {"key": "firstName", "type": "textfield", "label": "First Name"}, - { - "key": "lastName", - "type": "textfield", - "multiple": True, - "label": "Last Name", - }, - { - "label": "Select", - "key": "select", - "data": { - "values": [ - {"label": "A", "value": "a"}, - {"label": "B", "value": "b"}, - ], - "dataSrc": "manual", - "json": "", - "url": "", - "resource": "", - "custom": "", - }, - "type": "select", - "multiple": True, - }, - { - "type": "selectboxes", - "key": "selectboxes", - "values": [ - {"label": "Option 1", "value": "option1"}, - {"label": "Option 2", "value": "option2"}, - ], - }, - { - "label": "Radio", - "key": "radio", - "type": "radio", - "values": [ - {"label": "A", "value": "a"}, - {"label": "B", "value": "b"}, - ], - "dataSrc": "manual", - }, - ] - } - ) - FormStepFactory.create(form=form, form_definition=form_def_1) - - form_def_2 = FormDefinitionFactory.create( - configuration={ - "components": [ - { - "key": "file", - "type": "file", - "label": "File", - "validate": {"required": True}, - }, - { - "key": "notIncluded", - "type": "textfield", - "label": "Not included text field", - }, - ] - } - ) - FormStepFactory.create(form=form, form_definition=form_def_2) - - vars_to_include = ( - "firstName", - "lastName", - "select", - "selectboxes", - "radio", - "file", - "auth_bsn", - "today", - ) - schema = form_variables_to_json_schema(form, vars_to_include) - - self.assertEqual(set(schema["properties"]), set(vars_to_include)) - self.assertEqual(schema["required"], ["auth_bsn", "today", "file"]) - - -# TODO-4980: add to variables app if get_json_schema_from_form_variable is moved to -# FormVariable -class TestGetJsonSchemaFromFormVariableTests(TestCase): - - def test_component(self): - form = FormFactory.create() - form_def = FormDefinitionFactory.create( - configuration={ - "components": [ - { - "key": "textfield", - "type": "textfield", - "label": "Foo", - "source": FormVariableSources.component, - }, - ] - } - ) - FormStepFactory.create(form=form, form_definition=form_def) - - var = form_def.formvariable_set.first() - schema = get_json_schema_from_form_variable(var) - - expected_schema = {"title": "Foo", "type": "string"} - self.assertEqual(schema, expected_schema) - - def test_user_defined(self): - var = FormVariableFactory.create( - name="Foo", - key="foo", - source=FormVariableSources.user_defined, - data_type=FormVariableDataTypes.array, - initial_value=["A", "B", "C"], - ) - - schema = get_json_schema_from_form_variable(var) - - expected_schema = {"title": "Foo", "type": "array"} - self.assertEqual(schema, expected_schema) - - -# TODO-4980: add to variables app if is_form_variable_required is moved toFormVariable -class TestIsFormVariableRequired(TestCase): - - def test_component_default(self): - form = FormFactory.create() - form_def = FormDefinitionFactory.create( - configuration={ - "components": [ - { - "key": "textfield", - "type": "textfield", - "label": "Foo", - "source": FormVariableSources.component, - }, - ] - } - ) - FormStepFactory.create(form=form, form_definition=form_def) - - var = form_def.formvariable_set.first() - required = is_form_variable_required(var) - - self.assertFalse(required) - - def test_component_required(self): - form = FormFactory.create() - form_def = FormDefinitionFactory.create( - configuration={ - "components": [ - { - "key": "textfield", - "type": "textfield", - "label": "Foo", - "source": FormVariableSources.component, - "validate": {"required": True}, - }, - ] - } - ) - FormStepFactory.create(form=form, form_definition=form_def) - - var = form_def.formvariable_set.first() - required = is_form_variable_required(var) - - self.assertTrue(required) - - def test_user_defined(self): - var = FormVariableFactory.create( - name="Foo", - key="foo", - source=FormVariableSources.user_defined, - data_type=FormVariableDataTypes.array, - initial_value=["A", "B", "C"], - ) - - required = is_form_variable_required(var) - - self.assertTrue(required) diff --git a/src/openforms/forms/tests/test_json_schema.py b/src/openforms/forms/tests/test_json_schema.py new file mode 100644 index 0000000000..f57a08bdb3 --- /dev/null +++ b/src/openforms/forms/tests/test_json_schema.py @@ -0,0 +1,258 @@ +from django.test import TestCase + +from openforms.forms.tests.factories import ( + FormDefinitionFactory, + FormFactory, + FormStepFactory, + FormVariableFactory, +) +from openforms.variables.constants import FormVariableDataTypes, FormVariableSources + +from ..json_schema import generate_json_schema + + +class GenerateJsonSchemaTests(TestCase): + def test_correct_variables_included_in_schema(self): + form = FormFactory.create() + form_def_1 = FormDefinitionFactory.create( + configuration={ + "components": [ + {"key": "firstName", "type": "textfield", "label": "First Name"}, + { + "key": "lastName", + "type": "textfield", + "multiple": True, + "label": "Last Name", + }, + { + "label": "Select", + "key": "select", + "data": { + "values": [ + {"label": "A", "value": "a"}, + {"label": "B", "value": "b"}, + ], + "dataSrc": "manual", + "json": "", + "url": "", + "resource": "", + "custom": "", + }, + "type": "select", + "multiple": True, + }, + { + "type": "selectboxes", + "key": "selectboxes", + "values": [ + {"label": "Option 1", "value": "option1"}, + {"label": "Option 2", "value": "option2"}, + ], + }, + { + "label": "Radio", + "key": "radio", + "type": "radio", + "values": [ + {"label": "A", "value": "a"}, + {"label": "B", "value": "b"}, + ], + "dataSrc": "manual", + }, + ] + } + ) + FormStepFactory.create(form=form, form_definition=form_def_1) + + form_def_2 = FormDefinitionFactory.create( + configuration={ + "components": [ + { + "key": "file", + "type": "file", + "label": "File", + "validate": {"required": True}, + }, + { + "key": "notIncluded", + "type": "textfield", + "label": "Not included text field", + }, + ] + } + ) + FormStepFactory.create(form=form, form_definition=form_def_2) + + FormVariableFactory.create( + form=form, + name="Foo", + key="foo", + user_defined=True, + data_type=FormVariableDataTypes.array, + initial_value=["A", "B", "C"], + ) + + vars_to_include = ( + "firstName", + "lastName", + "select", + "selectboxes", + "radio", + "file", + "auth_bsn", + "today", + "foo", + ) + schema = generate_json_schema(form, vars_to_include) + + expected_schema = { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "type": "object", + "properties": { + "today": {"title": "Today's date", "type": "string", "format": "date"}, + "auth_bsn": { + "title": "BSN", + "description": "Uniquely identifies the authenticated person. This value follows the rules for Dutch social security numbers.", + "type": "string", + "pattern": "^\\d{9}$", + "format": "nl-bsn", + }, + "firstName": {"title": "First Name", "type": "string"}, + "lastName": { + "title": "Last Name", + "type": "array", + "items": {"type": "string"}, + }, + "select": { + "type": "array", + "items": {"type": "string", "enum": ["a", "b", ""]}, + "title": "Select", + }, + "selectboxes": { + "title": "Select boxes", + "type": "object", + "properties": { + "option1": {"type": "boolean"}, + "option2": {"type": "boolean"}, + }, + "required": ["option1", "option2"], + "additionalProperties": False, + }, + "radio": {"title": "Radio", "type": "string", "enum": ["a", "b", ""]}, + "file": { + "title": "File", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": {"type": "string"}, + "originalName": {"type": "string"}, + "size": {"type": "number", "description": "Size in bytes"}, + "storage": {"type": "string"}, + "type": {"type": "string"}, + "url": {"type": "string", "format": "uri"}, + "data": { + "type": "object", + "properties": { + "baseUrl": {"type": "string", "format": "uri"}, + "form": {"type": "string"}, + "name": {"type": "string"}, + "project": {"type": "string"}, + "size": { + "type": "number", + "description": "Size in bytes", + }, + "url": {"type": "string", "format": "uri"}, + }, + "required": [ + "baseUrl", + "form", + "name", + "project", + "size", + "url", + ], + }, + }, + "required": [ + "name", + "originalName", + "size", + "storage", + "type", + "url", + "data", + ], + }, + }, + "foo": {"type": "array", "title": "Foo"}, + }, + "required": ( + "firstName", + "lastName", + "select", + "selectboxes", + "radio", + "file", + "auth_bsn", + "today", + "foo", + ), + "additionalProperties": False, + } + + self.assertEqual(schema, expected_schema) + + +# TODO-4980: move to openforms.utils.json_schema, or somewhere else? +class FormVariableAsJsonSchemaTests(TestCase): + + def test_component(self): + form = FormFactory.create() + form_def = FormDefinitionFactory.create( + configuration={ + "components": [ + { + "key": "textfield", + "type": "textfield", + "label": "Foo", + "source": FormVariableSources.component, + }, + ] + } + ) + FormStepFactory.create(form=form, form_definition=form_def) + + var = form_def.formvariable_set.first() + schema = var.as_json_schema() + + expected_schema = {"title": "Foo", "type": "string"} + self.assertEqual(schema, expected_schema) + + def test_user_defined(self): + var = FormVariableFactory.create( + name="Foo", + key="foo", + source=FormVariableSources.user_defined, + data_type=FormVariableDataTypes.array, + initial_value=["A", "B", "C"], + ) + + schema = var.as_json_schema() + + expected_schema = {"title": "Foo", "type": "array"} + self.assertEqual(schema, expected_schema) + + def test_schema_assigned_manually(self): + var = FormVariableFactory.create( + name="Foo", + key="foo", + data_type=FormVariableDataTypes.object, + initial_value={"foo": "bar"}, + ) + var.json_schema = {"type": "string"} + + schema = var.as_json_schema() + + expected_schema = {"type": "string"} + self.assertEqual(schema, expected_schema) diff --git a/src/openforms/forms/tests/variables/test_variables_in_logic_trigger.py b/src/openforms/forms/tests/variables/test_variables_in_logic_trigger.py index cff8d06ec5..7679421f6c 100644 --- a/src/openforms/forms/tests/variables/test_variables_in_logic_trigger.py +++ b/src/openforms/forms/tests/variables/test_variables_in_logic_trigger.py @@ -22,10 +22,6 @@ class DemoNow(BaseStaticVariable): def get_initial_value(self, *args, **kwargs): return "2021-07-16T21:15:00+00:00" - @staticmethod - def as_json_schema(): - return {} - class DemoAuth(BaseStaticVariable): name = "Authentication identifier" @@ -38,10 +34,6 @@ def get_initial_value(self, *args, **kwargs): "value": "123456782", } - @staticmethod - def as_json_schema(): - return {} - register = Registry() register("now")(DemoNow) diff --git a/src/openforms/registrations/contrib/json_dump/plugin.py b/src/openforms/registrations/contrib/json_dump/plugin.py index 8ee0670694..0af6044217 100644 --- a/src/openforms/registrations/contrib/json_dump/plugin.py +++ b/src/openforms/registrations/contrib/json_dump/plugin.py @@ -39,6 +39,8 @@ def register_submission( state = submission.load_submission_value_variables_state() # Generate values + # TODO: keys with a period (e.g. `foo.bar`) will currently not be added to the + # submission data. This will be fixed with issue 5041 all_values: JSONObject = { **state.get_static_data(), **state.get_data(), # dynamic values from user input diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml index 65c358a4d6..5e563723ea 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_exception_raised_when_service_returns_unexpected_status_code.yaml @@ -6,18 +6,19 @@ interactions: \"Uniquely identifies the authenticated person. This value follows the rules for Dutch social security numbers.\", \"type\": \"string\", \"pattern\": \"^\\\\d{9}$\", \"format\": \"nl-bsn\"}, \"firstName\": {\"title\": \"Firstname\", \"type\": - \"string\"}}, \"required\": [\"auth_bsn\"], \"additionalProperties\": false}}"' + \"string\"}}, \"required\": [\"firstName\", \"auth_bsn\"], \"additionalProperties\": + false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '560' + - '575' Content-Type: - application/json User-Agent: @@ -46,7 +47,7 @@ interactions: Content-Type: - text/html; charset=utf-8 Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml index f4d801d281..cba8df3f4c 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_multiple_file_uploads.yaml @@ -7,18 +7,18 @@ interactions: \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\": {\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}}, \"required\": [\"file_name\", \"content\"], \"additionalProperties\": false}}}, - \"required\": [], \"additionalProperties\": false}}"' + \"required\": [\"file\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '646' + - '654' Content-Type: - application/json User-Agent: @@ -36,8 +36,8 @@ interactions: \ \"required\": [\n \"file_name\",\n \"content\"\n \ ],\n \"type\": \"object\"\n },\n \"title\": \"File\",\n \"type\": \"array\"\n }\n },\n \"required\": - [],\n \"type\": \"object\"\n },\n \"values\": {\n \"file\": - [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n + [\n \"file\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \ \"file_name\": \"file1.txt\"\n },\n {\n \"content\": \"Q29udGVudCBleGFtcGxlIGlzIHRoaXMu\",\n \"file_name\": \"file2.txt\"\n \ }\n ]\n }\n },\n \"message\": \"Data received\"\n}\n" @@ -45,11 +45,11 @@ interactions: Connection: - close Content-Length: - - '1035' + - '1057' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml new file mode 100644 index 0000000000..5eafc1e694 --- /dev/null +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_nested_component_key.yaml @@ -0,0 +1,46 @@ +interactions: +- request: + body: '"{\"values\": {}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", + \"type\": \"object\", \"properties\": {\"foo.bar\": {\"title\": \"Nested key\", + \"type\": \"string\"}}, \"required\": [\"foo.bar\"], \"additionalProperties\": + false}}"' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI + Connection: + - keep-alive + Content-Length: + - '261' + Content-Type: + - application/json + User-Agent: + - python-requests/2.32.2 + method: POST + uri: http://localhost/json_plugin + response: + body: + string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n + \ \"additionalProperties\": false,\n \"properties\": {\n \"foo.bar\": + {\n \"title\": \"Nested key\",\n \"type\": \"string\"\n + \ }\n },\n \"required\": [\n \"foo.bar\"\n ],\n + \ \"type\": \"object\"\n },\n \"values\": {}\n },\n \"message\": + \"Data received\"\n}\n" + headers: + Connection: + - close + Content-Length: + - '384' + Content-Type: + - application/json + Date: + - Mon, 27 Jan 2025 11:59:48 GMT + Server: + - Werkzeug/3.1.3 Python/3.12.8 + status: + code: 201 + message: CREATED +version: 1 diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml index 8230b63760..54adcac91d 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_multiple_files_component.yaml @@ -4,19 +4,19 @@ interactions: \"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\": \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\": {\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}}, - \"required\": [], \"additionalProperties\": false}}}, \"required\": [], \"additionalProperties\": - false}}"' + \"required\": [], \"additionalProperties\": false}}}, \"required\": [\"file\"], + \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '456' + - '464' Content-Type: - application/json User-Agent: @@ -33,17 +33,18 @@ interactions: {\n \"type\": \"string\"\n }\n },\n \ \"required\": [],\n \"type\": \"object\"\n },\n \ \"title\": \"File\",\n \"type\": \"array\"\n }\n - \ },\n \"required\": [],\n \"type\": \"object\"\n },\n \"values\": - {\n \"file\": []\n }\n },\n \"message\": \"Data received\"\n}\n" + \ },\n \"required\": [\n \"file\"\n ],\n \"type\": + \"object\"\n },\n \"values\": {\n \"file\": []\n }\n },\n \"message\": + \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '739' + - '761' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml index 85cee1bd43..1d813a9514 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_no_file_upload_for_single_file_component.yaml @@ -2,18 +2,18 @@ interactions: - request: body: '"{\"values\": {\"file\": null}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\": {\"file\": {\"title\": \"File\", \"type\": - \"null\"}}, \"required\": [], \"additionalProperties\": false}}"' + \"null\"}}, \"required\": [\"file\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '253' + - '261' Content-Type: - application/json User-Agent: @@ -25,17 +25,18 @@ interactions: string: "{\n \"data\": {\n \"schema\": {\n \"$schema\": \"https://json-schema.org/draft/2020-12/schema\",\n \ \"additionalProperties\": false,\n \"properties\": {\n \"file\": {\n \"title\": \"File\",\n \"type\": \"null\"\n }\n - \ },\n \"required\": [],\n \"type\": \"object\"\n },\n \"values\": - {\n \"file\": null\n }\n },\n \"message\": \"Data received\"\n}\n" + \ },\n \"required\": [\n \"file\"\n ],\n \"type\": + \"object\"\n },\n \"values\": {\n \"file\": null\n }\n },\n + \ \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '372' + - '394' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml index b2ad5d6643..e1a8c0d1c7 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_one_file_upload_for_multiple_files_component.yaml @@ -6,18 +6,18 @@ interactions: \"array\", \"items\": {\"type\": \"object\", \"properties\": {\"file_name\": {\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}}, \"required\": [\"file_name\", \"content\"], \"additionalProperties\": false}}}, - \"required\": [], \"additionalProperties\": false}}"' + \"required\": [\"file\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '563' + - '571' Content-Type: - application/json User-Agent: @@ -35,19 +35,19 @@ interactions: \ \"required\": [\n \"file_name\",\n \"content\"\n \ ],\n \"type\": \"object\"\n },\n \"title\": \"File\",\n \"type\": \"array\"\n }\n },\n \"required\": - [],\n \"type\": \"object\"\n },\n \"values\": {\n \"file\": - [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n + [\n \"file\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"file\": [\n {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \ \"file_name\": \"file1.txt\"\n }\n ]\n }\n },\n \ \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '922' + - '944' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml index 71cd5c573c..22d85b8a28 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_form_variable_as_data_source.yaml @@ -2,19 +2,19 @@ interactions: - request: body: '"{\"values\": {\"radio\": \"A\"}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\": {\"radio\": {\"title\": \"Radio\", \"type\": - \"string\", \"enum\": [\"A\", \"B\", \"C\", \"\"]}}, \"required\": [], \"additionalProperties\": - false}}"' + \"string\", \"enum\": [\"A\", \"B\", \"C\", \"\"]}}, \"required\": [\"radio\"], + \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '298' + - '307' Content-Type: - application/json User-Agent: @@ -27,18 +27,18 @@ interactions: \ \"additionalProperties\": false,\n \"properties\": {\n \"radio\": {\n \"enum\": [\n \"A\",\n \"B\",\n \"C\",\n \ \"\"\n ],\n \"title\": \"Radio\",\n \"type\": - \"string\"\n }\n },\n \"required\": [],\n \"type\": - \"object\"\n },\n \"values\": {\n \"radio\": \"A\"\n }\n },\n - \ \"message\": \"Data received\"\n}\n" + \"string\"\n }\n },\n \"required\": [\n \"radio\"\n + \ ],\n \"type\": \"object\"\n },\n \"values\": {\n \"radio\": + \"A\"\n }\n },\n \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '475' + - '498' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml index 85e2a01f9f..8b6a98c826 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_radio_component_with_manual_data_source.yaml @@ -2,19 +2,19 @@ interactions: - request: body: '"{\"values\": {\"radio\": \"b\"}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\": {\"radio\": {\"title\": \"Radio\", \"type\": - \"string\", \"enum\": [\"a\", \"b\", \"c\", \"\"]}}, \"required\": [], \"additionalProperties\": - false}}"' + \"string\", \"enum\": [\"a\", \"b\", \"c\", \"\"]}}, \"required\": [\"radio\"], + \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '298' + - '307' Content-Type: - application/json User-Agent: @@ -27,18 +27,18 @@ interactions: \ \"additionalProperties\": false,\n \"properties\": {\n \"radio\": {\n \"enum\": [\n \"a\",\n \"b\",\n \"c\",\n \ \"\"\n ],\n \"title\": \"Radio\",\n \"type\": - \"string\"\n }\n },\n \"required\": [],\n \"type\": - \"object\"\n },\n \"values\": {\n \"radio\": \"b\"\n }\n },\n - \ \"message\": \"Data received\"\n}\n" + \"string\"\n }\n },\n \"required\": [\n \"radio\"\n + \ ],\n \"type\": \"object\"\n },\n \"values\": {\n \"radio\": + \"b\"\n }\n },\n \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '475' + - '498' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml index 9e73632635..e375fa1af4 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_component_with_form_variable_as_data_source.yaml @@ -5,19 +5,19 @@ interactions: \"type\": \"object\", \"properties\": {\"selectBoxes\": {\"title\": \"Select Boxes\", \"type\": \"object\", \"additionalProperties\": false, \"properties\": {\"A\": {\"type\": \"boolean\"}, \"B\": {\"type\": \"boolean\"}, \"C\": {\"type\": - \"boolean\"}}, \"required\": [\"A\", \"B\", \"C\"]}}, \"required\": [], \"additionalProperties\": - false}}"' + \"boolean\"}}, \"required\": [\"A\", \"B\", \"C\"]}}, \"required\": [\"selectBoxes\"], + \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '497' + - '512' Content-Type: - application/json User-Agent: @@ -34,19 +34,19 @@ interactions: \ \"C\": {\n \"type\": \"boolean\"\n }\n \ },\n \"required\": [\n \"A\",\n \"B\",\n \ \"C\"\n ],\n \"title\": \"Select Boxes\",\n - \ \"type\": \"object\"\n }\n },\n \"required\": [],\n - \ \"type\": \"object\"\n },\n \"values\": {\n \"selectBoxes\": - {\n \"A\": true,\n \"B\": false,\n \"C\": true\n }\n - \ }\n },\n \"message\": \"Data received\"\n}\n" + \ \"type\": \"object\"\n }\n },\n \"required\": [\n + \ \"selectBoxes\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"selectBoxes\": {\n \"A\": true,\n \"B\": false,\n + \ \"C\": true\n }\n }\n },\n \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '822' + - '851' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml index 1c19124990..15f11609a2 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_boxes_schema_required_is_empty_when_no_data_is_submitted.yaml @@ -4,18 +4,18 @@ interactions: \"type\": \"object\", \"properties\": {\"selectboxes\": {\"title\": \"Selectboxes\", \"type\": \"object\", \"properties\": {\"option1\": {\"type\": \"boolean\"}, \"option2\": {\"type\": \"boolean\"}}, \"required\": [], \"additionalProperties\": - false}}, \"required\": [], \"additionalProperties\": false}}"' + false}}, \"required\": [\"selectboxes\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '419' + - '434' Content-Type: - application/json User-Agent: @@ -30,18 +30,18 @@ interactions: \ \"option1\": {\n \"type\": \"boolean\"\n },\n \ \"option2\": {\n \"type\": \"boolean\"\n }\n \ },\n \"required\": [],\n \"title\": \"Selectboxes\",\n - \ \"type\": \"object\"\n }\n },\n \"required\": [],\n - \ \"type\": \"object\"\n },\n \"values\": {\n \"selectboxes\": - {}\n }\n },\n \"message\": \"Data received\"\n}\n" + \ \"type\": \"object\"\n }\n },\n \"required\": [\n + \ \"selectboxes\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"selectboxes\": {}\n }\n },\n \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '642' + - '671' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml index e44c52337b..e4800d3959 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_form_variable_as_data_source.yaml @@ -3,18 +3,18 @@ interactions: body: '"{\"values\": {\"select\": [\"A\", \"C\"]}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\": {\"select\": {\"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\": [\"A\", \"B\", \"C\", \"\"]}, \"title\": \"Select\"}}, - \"required\": [], \"additionalProperties\": false}}"' + \"required\": [\"select\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '344' + - '354' Content-Type: - application/json User-Agent: @@ -28,19 +28,19 @@ interactions: {\n \"items\": {\n \"enum\": [\n \"A\",\n \ \"B\",\n \"C\",\n \"\"\n ],\n \ \"type\": \"string\"\n },\n \"title\": \"Select\",\n - \ \"type\": \"array\"\n }\n },\n \"required\": [],\n - \ \"type\": \"object\"\n },\n \"values\": {\n \"select\": [\n - \ \"A\",\n \"C\"\n ]\n }\n },\n \"message\": \"Data - received\"\n}\n" + \ \"type\": \"array\"\n }\n },\n \"required\": [\n + \ \"select\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"select\": [\n \"A\",\n \"C\"\n ]\n }\n },\n + \ \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '583' + - '607' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml index 9a1789325c..81de8fabb6 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_select_component_with_manual_data_source.yaml @@ -3,18 +3,18 @@ interactions: body: '"{\"values\": {\"select\": [\"a\", \"c\"]}, \"schema\": {\"$schema\": \"https://json-schema.org/draft/2020-12/schema\", \"type\": \"object\", \"properties\": {\"select\": {\"type\": \"array\", \"items\": {\"type\": \"string\", \"enum\": [\"a\", \"b\", \"c\", \"\"]}, \"title\": \"Select\"}}, - \"required\": [], \"additionalProperties\": false}}"' + \"required\": [\"select\"], \"additionalProperties\": false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '344' + - '354' Content-Type: - application/json User-Agent: @@ -28,19 +28,19 @@ interactions: {\n \"items\": {\n \"enum\": [\n \"a\",\n \ \"b\",\n \"c\",\n \"\"\n ],\n \ \"type\": \"string\"\n },\n \"title\": \"Select\",\n - \ \"type\": \"array\"\n }\n },\n \"required\": [],\n - \ \"type\": \"object\"\n },\n \"values\": {\n \"select\": [\n - \ \"a\",\n \"c\"\n ]\n }\n },\n \"message\": \"Data - received\"\n}\n" + \ \"type\": \"array\"\n }\n },\n \"required\": [\n + \ \"select\"\n ],\n \"type\": \"object\"\n },\n \"values\": + {\n \"select\": [\n \"a\",\n \"c\"\n ]\n }\n },\n + \ \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '583' + - '607' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml index 9073fa7ef4..60af51a5b9 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml +++ b/src/openforms/registrations/contrib/json_dump/tests/files/vcr_cassettes/JSONDumpBackendTests/JSONDumpBackendTests.test_submission_happy_flow.yaml @@ -10,18 +10,19 @@ interactions: \"string\"}, \"file\": {\"title\": \"File\", \"type\": \"object\", \"properties\": {\"file_name\": {\"type\": \"string\"}, \"content\": {\"type\": \"string\", \"format\": \"base64\"}}, \"required\": [\"file_name\", \"content\"], \"additionalProperties\": - false}}, \"required\": [\"auth_bsn\"], \"additionalProperties\": false}}"' + false}}, \"required\": [\"firstName\", \"file\", \"auth_bsn\"], \"additionalProperties\": + false}}"' headers: Accept: - '*/*' Accept-Encoding: - gzip, deflate, br Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc1NDYyOTcsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.RexAuQ6PNjAdp5DtEcz2dtcPXNknP0WnjZKKnr-LQEQ + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIiLCJpYXQiOjE3Mzc5NzkxODgsImNsaWVudF9pZCI6IiIsInVzZXJfaWQiOiIiLCJ1c2VyX3JlcHJlc2VudGF0aW9uIjoiIn0.1bWuAeZPvzPTeEVsggARdNYiy-X1V_uXIIdCICW2BVI Connection: - keep-alive Content-Length: - - '907' + - '932' Content-Type: - application/json User-Agent: @@ -43,20 +44,20 @@ interactions: \ \"content\"\n ],\n \"title\": \"File\",\n \"type\": \"object\"\n },\n \"firstName\": {\n \"title\": \"Firstname\",\n \ \"type\": \"string\"\n }\n },\n \"required\": [\n - \ \"auth_bsn\"\n ],\n \"type\": \"object\"\n },\n \"values\": - {\n \"auth_bsn\": \"123456789\",\n \"file\": {\n \"content\": - \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n \"file_name\": \"test_file.txt\"\n - \ },\n \"firstName\": \"We Are\"\n }\n },\n \"message\": \"Data - received\"\n}\n" + \ \"firstName\",\n \"file\",\n \"auth_bsn\"\n ],\n + \ \"type\": \"object\"\n },\n \"values\": {\n \"auth_bsn\": + \"123456789\",\n \"file\": {\n \"content\": \"VGhpcyBpcyBleGFtcGxlIGNvbnRlbnQu\",\n + \ \"file_name\": \"test_file.txt\"\n },\n \"firstName\": \"We + Are\"\n }\n },\n \"message\": \"Data received\"\n}\n" headers: Connection: - close Content-Length: - - '1278' + - '1315' Content-Type: - application/json Date: - - Wed, 22 Jan 2025 11:44:57 GMT + - Mon, 27 Jan 2025 11:59:48 GMT Server: - Werkzeug/3.1.3 Python/3.12.8 status: diff --git a/src/openforms/registrations/contrib/json_dump/tests/test_backend.py b/src/openforms/registrations/contrib/json_dump/tests/test_backend.py index 03c94d1c3a..03809cbfdc 100644 --- a/src/openforms/registrations/contrib/json_dump/tests/test_backend.py +++ b/src/openforms/registrations/contrib/json_dump/tests/test_backend.py @@ -1,3 +1,4 @@ +import unittest from base64 import b64decode from pathlib import Path @@ -109,7 +110,7 @@ def test_submission_happy_flow(self): "additionalProperties": False, }, }, - "required": ["auth_bsn"], + "required": ["firstName", "file", "auth_bsn"], "additionalProperties": False, }, }, @@ -233,7 +234,7 @@ def test_multiple_file_uploads(self): } }, "additionalProperties": False, - "required": [], + "required": ["file"], }, } @@ -308,7 +309,7 @@ def test_one_file_upload_for_multiple_files_component(self): } }, "additionalProperties": False, - "required": [], + "required": ["file"], }, } @@ -346,7 +347,7 @@ def test_no_file_upload_for_single_file_component(self): }, }, "additionalProperties": False, - "required": [], + "required": ["file"], }, } @@ -392,7 +393,7 @@ def test_no_file_upload_for_multiple_files_component(self): }, } }, - "required": [], + "required": ["file"], "additionalProperties": False, }, } @@ -422,10 +423,9 @@ def test_path_traversal_attack(self): json_plugin = JSONDumpRegistration("json_registration_plugin") for path in ("..", "../foo", "foo/..", "foo/../bar"): - with self.subTest(path): + with self.subTest(path), self.assertRaises(SuspiciousOperation): options["path"] = path - with self.assertRaises(SuspiciousOperation): - json_plugin.register_submission(submission, options) + json_plugin.register_submission(submission, options) def test_select_boxes_schema_required_is_empty_when_no_data_is_submitted(self): submission = SubmissionFactory.from_components( @@ -695,3 +695,32 @@ def test_radio_component_with_form_variable_as_data_source(self): result["api_response"]["data"]["schema"]["properties"]["radio"]["enum"], ["A", "B", "C", ""], ) + + @unittest.expectedFailure + def test_nested_component_key(self): + # TODO: will be fixed with issue 5041 + submission = SubmissionFactory.from_components( + [ + {"key": "foo.bar", "type": "textfield", "label": "Nested key"}, + ], + completed=True, + submitted_data={"foo": {"bar": "baz"}}, + with_public_registration_reference=True, + ) + + json_plugin = JSONDumpRegistration("json_registration_plugin") + + options: JSONDumpOptions = { + "service": self.service, + "path": "json_plugin", + "variables": ["foo.bar"], + } + + result = json_plugin.register_submission(submission, options) + assert result is not None + + self.assertEqual(result["api_response"]["data"]["values"]["foo.bar"], "baz") + self.assertEqual( + result["api_response"]["data"]["schema"]["properties"]["foo.bar"]["type"], + "string", + ) diff --git a/src/openforms/variables/tests/test_data_type_to_json_schema.py b/src/openforms/variables/tests/test_data_type_to_json_schema.py new file mode 100644 index 0000000000..326a5d8fc5 --- /dev/null +++ b/src/openforms/variables/tests/test_data_type_to_json_schema.py @@ -0,0 +1,23 @@ +from django.test import TestCase + +from jsonschema import Draft202012Validator + +from ..constants import DATA_TYPE_TO_JSON_SCHEMA + + +# TODO-4980: move to openforms.utils.json_schema.tests? +class DataTypeValidJsonSchemaTests(TestCase): + validator = Draft202012Validator + + def assertValidSchema(self, properties): + schema = { + "$schema": self.validator.META_SCHEMA["$id"], + **properties, + } + + self.validator.check_schema(schema) + + def test_all(self): + for data_type, schema in DATA_TYPE_TO_JSON_SCHEMA.items(): + with self.subTest(data_type): + self.assertValidSchema(schema) diff --git a/src/openforms/variables/tests/test_registry.py b/src/openforms/variables/tests/test_registry.py index edc1f13276..af753efd5f 100644 --- a/src/openforms/variables/tests/test_registry.py +++ b/src/openforms/variables/tests/test_registry.py @@ -18,10 +18,6 @@ class DemoVariable(BaseStaticVariable): def get_initial_value(self, *args, **kwargs): return "Test!" - @staticmethod - def as_json_schema(): - return {} - static_vars = list(test_static_variables_register) self.assertEqual(1, len(static_vars)) diff --git a/src/openforms/variables/tests/test_static_variables.py b/src/openforms/variables/tests/test_static_variables.py index 340c5c3a8c..e9e369a67d 100644 --- a/src/openforms/variables/tests/test_static_variables.py +++ b/src/openforms/variables/tests/test_static_variables.py @@ -9,14 +9,6 @@ from openforms.submissions.tests.factories import SubmissionFactory from ..registry import register_static_variable as register -from ..static_variables.static_variables import ( - CurrentYear, - Environment, - FormID, - FormName, - Now, - Today, -) def _get_variable(key: str, **kwargs): @@ -131,10 +123,15 @@ def test_date_has_the_right_day(self): self.assertEqual(variable.initial_value.day, 24) +# TODO-4980: move to openforms.utils.json_schema.tests? class StaticVariablesValidJsonSchemaTests(TestCase): validator = Draft202012Validator - def check_schema(self, properties): + @staticmethod + def _get_json_schema(key: str): + return register[key].as_json_schema() + + def assertValidSchema(self, properties): schema = { "$schema": self.validator.META_SCHEMA["$id"], **properties, @@ -143,25 +140,25 @@ def check_schema(self, properties): self.validator.check_schema(schema) def test_now(self): - schema = Now.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("now") + self.assertValidSchema(schema) def test_today(self): - schema = Today.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("today") + self.assertValidSchema(schema) def test_current_year(self): - schema = CurrentYear.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("current_year") + self.assertValidSchema(schema) def test_environment(self): - schema = Environment.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("environment") + self.assertValidSchema(schema) def test_form_name(self): - schema = FormName.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("form_name") + self.assertValidSchema(schema) def test_form_id(self): - schema = FormID.as_json_schema() - self.check_schema(schema) + schema = self._get_json_schema("form_id") + self.assertValidSchema(schema) diff --git a/src/openforms/variables/tests/test_user_defined_variables.py b/src/openforms/variables/tests/test_user_defined_variables.py deleted file mode 100644 index 7b8949690d..0000000000 --- a/src/openforms/variables/tests/test_user_defined_variables.py +++ /dev/null @@ -1,54 +0,0 @@ -from django.test import TestCase - -from jsonschema import Draft202012Validator - -from ..constants import FormVariableDataTypes -from ..service import get_json_schema_for_user_defined_variable - - -class UserDefinedVariablesValidJsonSchemaTests(TestCase): - validator = Draft202012Validator - - def check_schema(self, properties): - schema = { - "$schema": self.validator.META_SCHEMA["$id"], - **properties, - } - - self.validator.check_schema(schema) - - def test_string(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.string) - self.check_schema(base) - - def test_boolean(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.boolean) - self.check_schema(base) - - def test_object(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.object) - self.check_schema(base) - - def test_array(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.array) - self.check_schema(base) - - def test_int(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.int) - self.check_schema(base) - - def test_float(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.float) - self.check_schema(base) - - def test_datetime(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.datetime) - self.check_schema(base) - - def test_date(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.date) - self.check_schema(base) - - def test_time(self): - base = get_json_schema_for_user_defined_variable(FormVariableDataTypes.time) - self.check_schema(base) diff --git a/src/openforms/variables/tests/test_views.py b/src/openforms/variables/tests/test_views.py index 6f38c36d0d..368f582669 100644 --- a/src/openforms/variables/tests/test_views.py +++ b/src/openforms/variables/tests/test_views.py @@ -56,10 +56,6 @@ class DemoNow(BaseStaticVariable): def get_initial_value(self, *args, **kwargs): return "2021-07-16T21:15:00+00:00" - @staticmethod - def as_json_schema(): - return {} - register = VariableRegistry() register("now")(DemoNow) @@ -133,10 +129,6 @@ class DemoNow(BaseStaticVariable): def get_initial_value(self, *args, **kwargs): return "demo initial value" - @staticmethod - def as_json_schema(): - return {} - variables_registry = VariableRegistry() variables_registry("now")(DemoNow)