From be09f15ad0aedb31b48f33fde0b796d49c580e2b Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:25:36 +0100 Subject: [PATCH 01/13] [#3688] Improve typing for submission attachments --- src/openforms/submissions/models/submission.py | 4 +++- src/openforms/submissions/models/submission_files.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/openforms/submissions/models/submission.py b/src/openforms/submissions/models/submission.py index db82e32446..76ebf0ddae 100644 --- a/src/openforms/submissions/models/submission.py +++ b/src/openforms/submissions/models/submission.py @@ -673,7 +673,9 @@ def get_attachments(self) -> "SubmissionFileAttachmentQuerySet": return SubmissionFileAttachment.objects.for_submission(self) - attachments = property(get_attachments) + @property + def attachments(self) -> "SubmissionFileAttachmentQuerySet": + return self.get_attachments() def get_merged_attachments(self) -> Mapping[str, list["SubmissionFileAttachment"]]: if not hasattr(self, "_merged_attachments"): diff --git a/src/openforms/submissions/models/submission_files.py b/src/openforms/submissions/models/submission_files.py index 02dabf5cd9..9a8ad32ae7 100644 --- a/src/openforms/submissions/models/submission_files.py +++ b/src/openforms/submissions/models/submission_files.py @@ -70,7 +70,9 @@ class Meta: verbose_name_plural = _("temporary file uploads") -class SubmissionFileAttachmentQuerySet(DeleteFilesQuerySetMixin, models.QuerySet): +class SubmissionFileAttachmentQuerySet( + DeleteFilesQuerySetMixin, models.QuerySet["SubmissionFileAttachment"] +): def for_submission(self, submission: Submission): return self.filter(submission_step__submission=submission) From e4be7a0ee45d7658f8aedb8f828b62e00e609fc7 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 20 Mar 2024 17:26:34 +0100 Subject: [PATCH 02/13] [#3688] Remove `AttachmentUrls` variable Will not be necessary anymore --- .../contrib/objects_api/registration_variables.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/openforms/registrations/contrib/objects_api/registration_variables.py b/src/openforms/registrations/contrib/objects_api/registration_variables.py index e9b503d35e..641b1945a0 100644 --- a/src/openforms/registrations/contrib/objects_api/registration_variables.py +++ b/src/openforms/registrations/contrib/objects_api/registration_variables.py @@ -46,17 +46,6 @@ def get_initial_value(self, submission: Submission | None = None): return submission.objects_api_registration_data.csv_url -@register("attachment_urls") -class AttachmentUrls(BaseStaticVariable): - name = _("Attachment Urls") - data_type = FormVariableDataTypes.array - - def get_initial_value(self, submission: Submission | None = None): - if submission is None: - return None - return submission.objects_api_registration_data.attachment_urls - - @register("payment_completed") class PaymentCompleted(BaseStaticVariable): name = _("Payment completed") From d0ea12f616f667dbd02ef3f634dd586b27552c4a Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:40:48 +0100 Subject: [PATCH 03/13] [#3688] Add `JWT_EXPIRY` env variable to Open Zaak Compose Necessary for tests making use of `freezegun` --- docker/docker-compose.open-zaak.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/docker-compose.open-zaak.yml b/docker/docker-compose.open-zaak.yml index c80e778fe7..78434947ff 100644 --- a/docker/docker-compose.open-zaak.yml +++ b/docker/docker-compose.open-zaak.yml @@ -38,6 +38,7 @@ services: - CELERY_BROKER_URL=redis://openzaak-redis:6379/1 - CELERY_RESULT_BACKEND=redis://openzaak-redis:6379/1 - NOTIFICATIONS_DISABLED=true + - JWT_EXPIRY=99999999999 # Roughly 3170 years. This is required for tests with time frozen to work ports: - 8003:8000 volumes: &openzaak_web_volumes From beb52f26637ccb096feb039ba3afb5c54a184be8 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:41:51 +0100 Subject: [PATCH 04/13] [#3688] Add fixtures to Objects APIs for following tests --- .../fixtures/objects_api_fixtures.json | 20 +++++++ .../fixtures/objecttypes_api_fixtures.json | 55 ++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/docker/objects-apis/fixtures/objects_api_fixtures.json b/docker/objects-apis/fixtures/objects_api_fixtures.json index aad3e55bb7..a367d2e740 100644 --- a/docker/objects-apis/fixtures/objects_api_fixtures.json +++ b/docker/objects-apis/fixtures/objects_api_fixtures.json @@ -8,6 +8,15 @@ "_name": "Person" } }, + { + "model": "core.objecttype", + "pk": 2, + "fields": { + "service": 1, + "uuid": "527b8408-7421-4808-a744-43ccb7bdaaa2", + "_name": "File uploads" + } + }, { "model": "token.tokenauth", "pk": "7657474c3d75f56ae0abd0d1bf7994b09964dca9", @@ -32,6 +41,17 @@ "fields": null } }, + { + "model": "token.permission", + "pk": 1, + "fields": { + "token_auth": "7657474c3d75f56ae0abd0d1bf7994b09964dca9", + "object_type": 2, + "mode": "read_and_write", + "use_fields": false, + "fields": null + } + }, { "model": "zgw_consumers.service", "pk": 1, diff --git a/docker/objects-apis/fixtures/objecttypes_api_fixtures.json b/docker/objects-apis/fixtures/objecttypes_api_fixtures.json index 988cf20f44..371db4a1f2 100644 --- a/docker/objects-apis/fixtures/objecttypes_api_fixtures.json +++ b/docker/objects-apis/fixtures/objecttypes_api_fixtures.json @@ -45,6 +45,29 @@ "allow_geometry": true } }, + { + "model": "core.objecttype", + "pk": 3, + "fields": { + "uuid": "527b8408-7421-4808-a744-43ccb7bdaaa2", + "name": "File Uploads", + "name_plural": "File Uploads", + "description": "", + "data_classification": "confidential", + "maintainer_organization": "", + "maintainer_department": "", + "contact_person": "", + "contact_email": "", + "source": "", + "update_frequency": "unknown", + "provider_organization": "", + "documentation_url": "", + "labels": {}, + "created_at": "2024-02-08", + "modified_at": "2024-02-08", + "allow_geometry": true + } + }, { "model": "core.objectversion", "pk": 1, @@ -133,7 +156,9 @@ "name": { "type": "object", "properties": { - "last.name": {"type": "string"} + "last.name": { + "type": "string" + } } }, "submission_pdf_url": { @@ -186,6 +211,34 @@ "status": "published" } }, + { + "model": "core.objectversion", + "pk": 5, + "fields": { + "object_type": 3, + "version": 1, + "created_at": "2024-02-08", + "modified_at": "2024-02-08", + "published_at": "2024-02-08", + "json_schema": { + "type": "object", + "title": "File uploads", + "$schema": "https://json-schema.org/draft/2020-12/schema", + "properties": { + "single_file": { + "type": "string" + }, + "multiple_files": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "status": "published" + } + }, { "model": "token.tokenauth", "pk": "171be5abaf41e7856b423ad513df1ef8f867ff48", From 33bc8b47b8608c87a741764fe403702e67692368 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:42:45 +0100 Subject: [PATCH 05/13] [#3688] Add new model --- ...gistrationdata_attachment_urls_and_more.py | 49 +++++++++++++++++++ .../contrib/objects_api/models.py | 24 ++++++--- 2 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 src/openforms/registrations/contrib/objects_api/migrations/0014_remove_objectsapiregistrationdata_attachment_urls_and_more.py diff --git a/src/openforms/registrations/contrib/objects_api/migrations/0014_remove_objectsapiregistrationdata_attachment_urls_and_more.py b/src/openforms/registrations/contrib/objects_api/migrations/0014_remove_objectsapiregistrationdata_attachment_urls_and_more.py new file mode 100644 index 0000000000..7bcd598448 --- /dev/null +++ b/src/openforms/registrations/contrib/objects_api/migrations/0014_remove_objectsapiregistrationdata_attachment_urls_and_more.py @@ -0,0 +1,49 @@ +# Generated by Django 4.2.10 on 2024-03-21 11:36 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ("submissions", "0004_auto_20231128_1536"), + ("registrations_objects_api", "0013_objectsapiregistrationdata"), + ] + + operations = [ + migrations.RemoveField( + model_name="objectsapiregistrationdata", + name="attachment_urls", + ), + migrations.CreateModel( + name="ObjectsAPISubmissionAttachment", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "document_url", + models.URLField( + help_text="The URL of the submission attachment registered in the Documents API.", + verbose_name="document_url", + ), + ), + ( + "submission_file_attachment", + models.ForeignKey( + help_text="The submission file attachment.", + on_delete=django.db.models.deletion.CASCADE, + to="submissions.submissionfileattachment", + verbose_name="submission file attachment", + ), + ), + ], + ), + ] diff --git a/src/openforms/registrations/contrib/objects_api/models.py b/src/openforms/registrations/contrib/objects_api/models.py index 5449920690..5d8a7fcd69 100644 --- a/src/openforms/registrations/contrib/objects_api/models.py +++ b/src/openforms/registrations/contrib/objects_api/models.py @@ -1,4 +1,3 @@ -from django.contrib.postgres.fields import ArrayField from django.core.exceptions import ValidationError from django.db import models from django.template.loader import render_to_string @@ -222,12 +221,21 @@ class ObjectsAPIRegistrationData(models.Model): help_text=_("The CSV URL of the document on the Documents API."), blank=True, ) - attachment_urls = ArrayField( - models.URLField( - _("attachment url"), help_text=_("The attachment URL on the Documents API.") + + +class ObjectsAPISubmissionAttachment(models.Model): + """A utility model to link a submission file attachment with the Documents API URL.""" + + submission_file_attachment = models.ForeignKey( + "submissions.SubmissionFileAttachment", + on_delete=models.CASCADE, + verbose_name=_("submission file attachment"), + help_text=_("The submission file attachment."), + ) + + document_url = models.URLField( + _("document_url"), + help_text=_( + "The URL of the submission attachment registered in the Documents API." ), - verbose_name=_("attachment urls"), - help_text=_("The list of attachment URLs on the Documents API."), - blank=True, - default=list, ) From b78cfe5fdd01e5bd53a561dd99f6033ba950a3ed Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:43:13 +0100 Subject: [PATCH 06/13] [#3688] Adapt logic for `fileupload` registration --- .../objects_api/submission_registration.py | 113 +++++++++++------- 1 file changed, 69 insertions(+), 44 deletions(-) diff --git a/src/openforms/registrations/contrib/objects_api/submission_registration.py b/src/openforms/registrations/contrib/objects_api/submission_registration.py index b07aaf0978..ff9548a087 100644 --- a/src/openforms/registrations/contrib/objects_api/submission_registration.py +++ b/src/openforms/registrations/contrib/objects_api/submission_registration.py @@ -18,14 +18,18 @@ from openforms.registrations.exceptions import RegistrationFailed from openforms.submissions.exports import create_submission_export from openforms.submissions.mapping import SKIP, FieldConf, apply_data_mapping -from openforms.submissions.models import Submission, SubmissionReport +from openforms.submissions.models import ( + Submission, + SubmissionFileAttachment, + SubmissionReport, +) from openforms.typing import JSONValue from openforms.variables.service import get_static_variables from openforms.variables.utils import get_variables_for_context from ...constants import REGISTRATION_ATTRIBUTE, RegistrationAttribute from .client import DocumentenClient, get_documents_client -from .models import ObjectsAPIRegistrationData +from .models import ObjectsAPIRegistrationData, ObjectsAPISubmissionAttachment from .registration_variables import register as variables_registry from .typing import ( ConfigVersion, @@ -119,46 +123,39 @@ def register_submission_csv( return submission_csv_document["url"] -def register_submission_attachments( +def register_submission_attachment( submission: Submission, + attachment: SubmissionFileAttachment, options: RegistrationOptions, documents_client: DocumentenClient, -) -> list[str]: - if not options["informatieobjecttype_attachment"]: - return [] - - attachment_urls: list[str] = [] - for attachment in submission.attachments: - attachment_options = build_options( - options, - { - "informatieobjecttype": "informatieobjecttype_attachment", # Different IOT than for the report - "organisatie_rsin": "organisatie_rsin", - "doc_vertrouwelijkheidaanduiding": "doc_vertrouwelijkheidaanduiding", - }, - ) - - component_overwrites = { - "doc_vertrouwelijkheidaanduiding": attachment.doc_vertrouwelijkheidaanduiding, - "titel": attachment.titel, - "organisatie_rsin": attachment.bronorganisatie, - "informatieobjecttype": attachment.informatieobjecttype, - } - - for key, value in component_overwrites.items(): - if value: - attachment_options[key] = value +) -> str: - attachment_document = create_attachment_document( - client=documents_client, - name=submission.form.admin_name, - submission_attachment=attachment, - options=attachment_options, - language=attachment.submission_step.submission.language_code, # assume same as submission - ) - attachment_urls.append(attachment_document["url"]) + attachment_options = build_options( + options, + { + "informatieobjecttype": "informatieobjecttype_attachment", # Different IOT than for the report + "organisatie_rsin": "organisatie_rsin", + "doc_vertrouwelijkheidaanduiding": "doc_vertrouwelijkheidaanduiding", + }, + ) + component_overwrites = { + "doc_vertrouwelijkheidaanduiding": attachment.doc_vertrouwelijkheidaanduiding, + "titel": attachment.titel, + "organisatie_rsin": attachment.bronorganisatie, + "informatieobjecttype": attachment.informatieobjecttype, + } + for key, value in component_overwrites.items(): + if value: + attachment_options[key] = value + attachment_document = create_attachment_document( + client=documents_client, + name=submission.form.admin_name, + submission_attachment=attachment, + options=attachment_options, + language=attachment.submission_step.submission.language_code, # assume same as submission + ) - return attachment_urls + return attachment_document["url"] @contextmanager @@ -221,12 +218,19 @@ def save_registration_data( submission, options, documents_client ) - if not registration_data.attachment_urls: - # TODO turn attachments into a dictionary when giving users more options than - # just urls. - registration_data.attachment_urls = register_submission_attachments( - submission, options, documents_client - ) + if options["informatieobjecttype_attachment"]: + for attachment in submission.attachments: + try: + ObjectsAPISubmissionAttachment.objects.get( + submission_file_attachment=attachment + ) + except ObjectsAPISubmissionAttachment.DoesNotExist: + ObjectsAPISubmissionAttachment.objects.create( + submission_file_attachment=attachment, + document_url=register_submission_attachment( + submission, attachment, options, documents_client + ), + ) @abstractmethod def get_object_data( @@ -268,6 +272,10 @@ def get_object_data( submission=submission ) + objects_api_attachments = ObjectsAPISubmissionAttachment.objects.filter( + submission_file_attachment__submission_step__submission=submission + ) + context = { "_submission": submission, "productaanvraag_type": options["productaanvraag_type"], @@ -279,7 +287,9 @@ def get_object_data( "public_reference": submission.public_registration_reference, "kenmerk": str(submission.uuid), "language_code": submission.language_code, - "uploaded_attachment_urls": registration_data.attachment_urls, + "uploaded_attachment_urls": [ + attachment.document_url for attachment in objects_api_attachments + ], "pdf_url": registration_data.pdf_url, "csv_url": registration_data.csv_url, }, @@ -339,8 +349,23 @@ class ObjectsAPIV2Handler(ObjectsAPIRegistrationHandler[RegistrationOptionsV2]): def get_object_data( self, submission: Submission, options: RegistrationOptionsV2 ) -> dict[str, Any]: + state = submission.load_submission_value_variables_state() dynamic_values = state.get_data() + + # For every file upload component, we alter the value of the variable to be + # the Document API URL(s). + for key in dynamic_values.keys(): + objects_api_attachments = ObjectsAPISubmissionAttachment.objects.filter( + submission_file_attachment__submission_variable__submission=submission, + submission_file_attachment__submission_variable__key=key, + ) + if objects_api_attachments.exists(): + urls = list( + objects_api_attachments.values_list("document_url", flat=True) + ) + dynamic_values[key] = urls[0] if len(urls) == 1 else urls + static_values = state.static_data() static_values.update( { From 2ab5ed6316d85fe768f3b3de63890552b501c1b6 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Thu, 21 Mar 2024 15:43:29 +0100 Subject: [PATCH 07/13] [#3688] Add test --- ....test_submission_with_file_components.yaml | 210 ++++++++++++++++++ .../objects_api/tests/test_backend_v2.py | 76 ++++++- 2 files changed, 285 insertions(+), 1 deletion(-) create mode 100644 src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml diff --git a/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml new file mode 100644 index 0000000000..71a535d569 --- /dev/null +++ b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml @@ -0,0 +1,210 @@ +interactions: +- request: + body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", + "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form + 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "video/x-ms-wmv", "inhoud": + "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment1.jpg", "beschrijving": + "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": 7}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcxMDg1NTYzNCwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.NJjZEPSwh9eGzntjwUB7rFAiaq_5DqYgVylWuKdtdMA + Connection: + - keep-alive + Content-Length: + - '452' + Content-Type: + - application/json + User-Agent: + - python-requests/2.31.0 + method: POST + uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten + response: + body: + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e","identificatie":"DOCUMENT-2024-0000000016","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"video/x-ms-wmv","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.494116Z","bestandsnaam":"attachment1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd + document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' + headers: + API-version: + - 1.4.2 + Allow: + - GET, POST, HEAD, OPTIONS + Content-Length: + - '1032' + Content-Type: + - application/json + Location: + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e + Referrer-Policy: + - same-origin + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +- request: + body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", + "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form + 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/vcard", "inhoud": + "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment2_1.jpg", + "beschrijving": "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": + 7}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcxMDg1NTYzNCwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.NJjZEPSwh9eGzntjwUB7rFAiaq_5DqYgVylWuKdtdMA + Connection: + - keep-alive + Content-Length: + - '450' + Content-Type: + - application/json + User-Agent: + - python-requests/2.31.0 + method: POST + uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten + response: + body: + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9","identificatie":"DOCUMENT-2024-0000000017","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/vcard","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.532395Z","bestandsnaam":"attachment2_1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd + document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' + headers: + API-version: + - 1.4.2 + Allow: + - GET, POST, HEAD, OPTIONS + Content-Length: + - '1030' + Content-Type: + - application/json + Location: + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9 + Referrer-Policy: + - same-origin + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +- request: + body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", + "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form + 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/vcard", "inhoud": + "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment2_2.jpg", + "beschrijving": "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": + 7}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcxMDg1NTYzNCwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.NJjZEPSwh9eGzntjwUB7rFAiaq_5DqYgVylWuKdtdMA + Connection: + - keep-alive + Content-Length: + - '450' + Content-Type: + - application/json + User-Agent: + - python-requests/2.31.0 + method: POST + uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten + response: + body: + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2","identificatie":"DOCUMENT-2024-0000000018","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/vcard","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.604970Z","bestandsnaam":"attachment2_2.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd + document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' + headers: + API-version: + - 1.4.2 + Allow: + - GET, POST, HEAD, OPTIONS + Content-Length: + - '1030' + Content-Type: + - application/json + Location: + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2 + Referrer-Policy: + - same-origin + Vary: + - Origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + X-XSS-Protection: + - 1; mode=block + status: + code: 201 + message: Created +- request: + body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2", + "record": {"typeVersion": 1, "data": {"single_file": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e", + "multiple_files": ["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9", + "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2"]}, + "startAt": "2024-03-19"}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate, br + Authorization: + - Token 7657474c3d75f56ae0abd0d1bf7994b09964dca9 + Connection: + - keep-alive + Content-Crs: + - EPSG:4326 + Content-Length: + - '525' + Content-Type: + - application/json + User-Agent: + - python-requests/2.31.0 + method: POST + uri: http://localhost:8002/api/v2/objects + response: + body: + string: '{"url":"http://localhost:8002/api/v2/objects/c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3","uuid":"c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3","type":"http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2","record":{"index":1,"typeVersion":1,"data":{"single_file":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e","multiple_files":["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9","http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2"]},"geometry":null,"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-03-21","correctionFor":null,"correctedBy":null}}' + headers: + Allow: + - GET, POST, HEAD, OPTIONS + Content-Crs: + - EPSG:4326 + Content-Length: + - '750' + Content-Type: + - application/json + Cross-Origin-Opener-Policy: + - same-origin + Location: + - http://localhost:8002/api/v2/objects/c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3 + Referrer-Policy: + - same-origin + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - DENY + status: + code: 201 + message: Created +version: 1 diff --git a/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py b/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py index eee2caf955..b722f633da 100644 --- a/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py +++ b/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py @@ -11,7 +11,10 @@ from openforms.registrations.contrib.objects_api.models import ( ObjectsAPIRegistrationData, ) -from openforms.submissions.tests.factories import SubmissionFactory +from openforms.submissions.tests.factories import ( + SubmissionFactory, + SubmissionFileAttachmentFactory, +) from openforms.utils.tests.vcr import OFVCRMixin from ..models import ObjectsAPIConfig @@ -169,3 +172,74 @@ def test_submission_with_objects_api_v2(self): "coordinates": [52.36673378967122, 4.893164274470299], }, ) + + def test_submission_with_file_components(self): + submission = SubmissionFactory.from_components( + [ + { + "key": "single_file", + "type": "file", + }, + { + "key": "multiple_files", + "type": "file", + "multiple": True, + }, + ], + completed=True, + ) + submission_step = submission.steps[0] + SubmissionFileAttachmentFactory.create( + submission_step=submission_step, + file_name="attachment1.jpg", + form_key="single_file", + ) + SubmissionFileAttachmentFactory.create( + submission_step=submission_step, + file_name="attachment2_1.jpg", + form_key="multiple_files", + ) + SubmissionFileAttachmentFactory.create( + submission_step=submission_step, + file_name="attachment2_2.jpg", + form_key="multiple_files", + ) + + v2_options: RegistrationOptionsV2 = { + "version": 2, + # See the docker compose fixtures for more info on these values: + "objecttype": "http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2", + "objecttype_version": 1, + "upload_submission_csv": False, + "informatieobjecttype_attachment": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", + "organisatie_rsin": "000000000", + "variables_mapping": [ + # fmt: off + { + "variable_key": "single_file", + "target_path": ["single_file"], + }, + { + "variable_key": "multiple_files", + "target_path": ["multiple_files"] + }, + # fmt: on + ], + } + + plugin = ObjectsAPIRegistration(PLUGIN_IDENTIFIER) + + # Run the registration + result = plugin.register_submission(submission, v2_options) + + self.assertEqual(result["type"], v2_options["objecttype"]) + self.assertEqual( + result["record"]["typeVersion"], v2_options["objecttype_version"] + ) + + self.assertTrue( + result["record"]["data"]["single_file"].startswith( + "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/" + ) + ) + self.assertEqual(len(result["record"]["data"]["multiple_files"]), 2) From 92696a2a8604d981ce0cab325d7f05ba7f6f70d3 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 22 Mar 2024 10:34:09 +0100 Subject: [PATCH 08/13] [#3688] Add a `post_delete` signal to properly handle deletions --- src/openforms/submissions/signals.py | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/openforms/submissions/signals.py b/src/openforms/submissions/signals.py index b496e775b3..e2547f4cee 100644 --- a/src/openforms/submissions/signals.py +++ b/src/openforms/submissions/signals.py @@ -1,13 +1,18 @@ import logging +from django.db import transaction from django.db.models import F -from django.db.models.base import ModelBase from django.db.models.signals import post_delete from django.dispatch import Signal, receiver from django.utils import timezone from openforms.forms.models.form_statistics import FormStatistics -from openforms.submissions.models import Submission, SubmissionReport +from openforms.submissions.models import ( + Submission, + SubmissionFileAttachment, + SubmissionReport, +) +from openforms.utils.files import _delete_obj_files, get_file_field_names logger = logging.getLogger(__name__) @@ -53,9 +58,23 @@ """ +@receiver(post_delete, sender=SubmissionFileAttachment) +def delete_obj_files( + sender: type[SubmissionFileAttachment], instance: SubmissionFileAttachment, **kwargs +): + """A ``post_delete`` signal ensuring file deletion on database record deletion. + + The implementation is identical to the :class:`openforms.utils.files.DeleteFileFieldFilesMixin` class, + and is required as the Django deletion internals might not call the model's ``delete`` in all cases. + """ + file_field_names = get_file_field_names(sender) + with transaction.atomic(): + _delete_obj_files(file_field_names, instance) + + @receiver(post_delete, sender=SubmissionReport) def delete_submission_report_files( - sender: ModelBase, instance: SubmissionReport, **kwargs + sender: type[SubmissionReport], instance: SubmissionReport, **kwargs ) -> None: logger.debug("Deleting file %r", instance.content.name) From 23b060277f57d1a5bf859bdb65fcef0c003e7a63 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:53:32 +0100 Subject: [PATCH 09/13] [#3688] Optimize queries, check for component multiple --- .../objects_api/submission_registration.py | 59 +++++++++++++------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/src/openforms/registrations/contrib/objects_api/submission_registration.py b/src/openforms/registrations/contrib/objects_api/submission_registration.py index ff9548a087..d208006a0d 100644 --- a/src/openforms/registrations/contrib/objects_api/submission_registration.py +++ b/src/openforms/registrations/contrib/objects_api/submission_registration.py @@ -1,9 +1,12 @@ import logging from abc import ABC, abstractmethod +from collections import defaultdict from contextlib import contextmanager from datetime import date, datetime from typing import Any, Generic, Iterator, TypeVar, cast +from django.db.models import F + import glom from typing_extensions import override @@ -219,19 +222,28 @@ def save_registration_data( ) if options["informatieobjecttype_attachment"]: + existing = [ + o.submission_file_attachment + for o in ObjectsAPISubmissionAttachment.objects.filter( + submission_file_attachment__submission_step__submission=submission + ) + ] + + objs: list[ObjectsAPISubmissionAttachment] = [] + for attachment in submission.attachments: - try: - ObjectsAPISubmissionAttachment.objects.get( - submission_file_attachment=attachment - ) - except ObjectsAPISubmissionAttachment.DoesNotExist: - ObjectsAPISubmissionAttachment.objects.create( - submission_file_attachment=attachment, - document_url=register_submission_attachment( - submission, attachment, options, documents_client - ), + if attachment not in existing: + objs.append( + ObjectsAPISubmissionAttachment( + submission_file_attachment=attachment, + document_url=register_submission_attachment( + submission, attachment, options, documents_client + ), + ) ) + ObjectsAPISubmissionAttachment.objects.bulk_create(objs) + @abstractmethod def get_object_data( self, @@ -355,16 +367,27 @@ def get_object_data( # For every file upload component, we alter the value of the variable to be # the Document API URL(s). + objects_api_attachments = ObjectsAPISubmissionAttachment.objects.filter( + submission_file_attachment__submission_variable__submission=submission + ).annotate( + variable_key=F("submission_file_attachment__submission_variable__key") + ) + + urls_map: defaultdict[str, list[str]] = defaultdict(list) + for o in objects_api_attachments: + urls_map[o.variable_key].append(o.document_url) + for key in dynamic_values.keys(): - objects_api_attachments = ObjectsAPISubmissionAttachment.objects.filter( - submission_file_attachment__submission_variable__submission=submission, - submission_file_attachment__submission_variable__key=key, - ) - if objects_api_attachments.exists(): - urls = list( - objects_api_attachments.values_list("document_url", flat=True) + if key in urls_map: + variable = state.get_variable(key) + is_multiple = variable.form_variable.form_definition.configuration_wrapper.component_map[ + key + ].get( + "multiple", False + ) + dynamic_values[key] = ( + urls_map[key][0] if not is_multiple else urls_map[key] ) - dynamic_values[key] = urls[0] if len(urls) == 1 else urls static_values = state.static_data() static_values.update( From a84ef1933fda7ed0aa1937cc9fe98cfe94a0e148 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:53:39 +0100 Subject: [PATCH 10/13] [#3688] Adapt tests For the multiple file component, create a single file attachment to make sure the component multiplicity is taken into account Adapt submission date after update to the 'now' static variable --- ....test_submission_with_file_components.yaml | 90 ++++--------------- ...s.test_submission_with_objects_api_v2.yaml | 42 ++++----- .../objects_api/tests/test_backend_v2.py | 12 ++- 3 files changed, 44 insertions(+), 100 deletions(-) diff --git a/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml index 71a535d569..3cd9e2bfc4 100644 --- a/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml +++ b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_file_components.yaml @@ -2,7 +2,7 @@ interactions: - request: body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form - 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "video/x-ms-wmv", "inhoud": + 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "model/iges", "inhoud": "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment1.jpg", "beschrijving": "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": 7}' headers: @@ -15,7 +15,7 @@ interactions: Connection: - keep-alive Content-Length: - - '452' + - '448' Content-Type: - application/json User-Agent: @@ -24,8 +24,8 @@ interactions: uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten response: body: - string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e","identificatie":"DOCUMENT-2024-0000000016","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form - 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"video/x-ms-wmv","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.494116Z","bestandsnaam":"attachment1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/34b8ef68-44f3-433c-895c-14b4dd975356","identificatie":"DOCUMENT-2024-0000000023","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"model/iges","taal":"nld","versie":1,"beginRegistratie":"2024-03-22T10:51:51.374015Z","bestandsnaam":"attachment1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/34b8ef68-44f3-433c-895c-14b4dd975356/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' headers: API-version: @@ -33,11 +33,11 @@ interactions: Allow: - GET, POST, HEAD, OPTIONS Content-Length: - - '1032' + - '1028' Content-Type: - application/json Location: - - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/34b8ef68-44f3-433c-895c-14b4dd975356 Referrer-Policy: - same-origin Vary: @@ -54,7 +54,7 @@ interactions: - request: body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form - 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/vcard", "inhoud": + 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "image/pjpeg", "inhoud": "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment2_1.jpg", "beschrijving": "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": 7}' @@ -68,7 +68,7 @@ interactions: Connection: - keep-alive Content-Length: - - '450' + - '451' Content-Type: - application/json User-Agent: @@ -77,8 +77,8 @@ interactions: uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten response: body: - string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9","identificatie":"DOCUMENT-2024-0000000017","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form - 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/vcard","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.532395Z","bestandsnaam":"attachment2_1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/2bca92b5-a0c2-4ec3-9361-85f7c13451cb","identificatie":"DOCUMENT-2024-0000000024","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"image/pjpeg","taal":"nld","versie":1,"beginRegistratie":"2024-03-22T10:51:51.413269Z","bestandsnaam":"attachment2_1.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/2bca92b5-a0c2-4ec3-9361-85f7c13451cb/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' headers: API-version: @@ -86,64 +86,11 @@ interactions: Allow: - GET, POST, HEAD, OPTIONS Content-Length: - - '1030' + - '1031' Content-Type: - application/json Location: - - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9 - Referrer-Policy: - - same-origin - Vary: - - Origin - X-Content-Type-Options: - - nosniff - X-Frame-Options: - - DENY - X-XSS-Protection: - - 1; mode=block - status: - code: 201 - message: Created -- request: - body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7", - "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form - 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/vcard", "inhoud": - "Y29udGVudA==", "status": "definitief", "bestandsnaam": "attachment2_2.jpg", - "beschrijving": "Bijgevoegd document", "indicatieGebruiksrecht": false, "bestandsomvang": - 7}' - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate, br - Authorization: - - Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2NsaWVudF9pZCIsImlhdCI6MTcxMDg1NTYzNCwiY2xpZW50X2lkIjoidGVzdF9jbGllbnRfaWQiLCJ1c2VyX2lkIjoiIiwidXNlcl9yZXByZXNlbnRhdGlvbiI6IiJ9.NJjZEPSwh9eGzntjwUB7rFAiaq_5DqYgVylWuKdtdMA - Connection: - - keep-alive - Content-Length: - - '450' - Content-Type: - - application/json - User-Agent: - - python-requests/2.31.0 - method: POST - uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten - response: - body: - string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2","identificatie":"DOCUMENT-2024-0000000018","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form - 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/vcard","taal":"nld","versie":1,"beginRegistratie":"2024-03-21T14:22:01.604970Z","bestandsnaam":"attachment2_2.jpg","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2/download?versie=1","bestandsomvang":7,"link":"","beschrijving":"Bijgevoegd - document","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/531f6c1a-97f7-478c-85f0-67d2f23661c7","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' - headers: - API-version: - - 1.4.2 - Allow: - - GET, POST, HEAD, OPTIONS - Content-Length: - - '1030' - Content-Type: - - application/json - Location: - - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2 + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/2bca92b5-a0c2-4ec3-9361-85f7c13451cb Referrer-Policy: - same-origin Vary: @@ -159,9 +106,8 @@ interactions: message: Created - request: body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2", - "record": {"typeVersion": 1, "data": {"single_file": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e", - "multiple_files": ["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9", - "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2"]}, + "record": {"typeVersion": 1, "data": {"single_file": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/34b8ef68-44f3-433c-895c-14b4dd975356", + "multiple_files": ["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/2bca92b5-a0c2-4ec3-9361-85f7c13451cb"]}, "startAt": "2024-03-19"}}' headers: Accept: @@ -175,7 +121,7 @@ interactions: Content-Crs: - EPSG:4326 Content-Length: - - '525' + - '415' Content-Type: - application/json User-Agent: @@ -184,20 +130,20 @@ interactions: uri: http://localhost:8002/api/v2/objects response: body: - string: '{"url":"http://localhost:8002/api/v2/objects/c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3","uuid":"c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3","type":"http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2","record":{"index":1,"typeVersion":1,"data":{"single_file":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/d82ae704-4f1d-46bb-9e34-0b82c3ff939e","multiple_files":["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/7049fdf3-ba00-409a-ae0b-2a57f5f880a9","http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/b94247e8-0ec3-4a55-bed8-af05511099d2"]},"geometry":null,"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-03-21","correctionFor":null,"correctedBy":null}}' + string: '{"url":"http://localhost:8002/api/v2/objects/7d9d7389-9fea-43bf-a630-84a60eaab373","uuid":"7d9d7389-9fea-43bf-a630-84a60eaab373","type":"http://objecttypes-web:8000/api/v2/objecttypes/527b8408-7421-4808-a744-43ccb7bdaaa2","record":{"index":1,"typeVersion":1,"data":{"single_file":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/34b8ef68-44f3-433c-895c-14b4dd975356","multiple_files":["http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/2bca92b5-a0c2-4ec3-9361-85f7c13451cb"]},"geometry":null,"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-03-22","correctionFor":null,"correctedBy":null}}' headers: Allow: - GET, POST, HEAD, OPTIONS Content-Crs: - EPSG:4326 Content-Length: - - '750' + - '641' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin Location: - - http://localhost:8002/api/v2/objects/c2c85d8d-809c-4ec8-9aa5-1b45aa13bda3 + - http://localhost:8002/api/v2/objects/7d9d7389-9fea-43bf-a630-84a60eaab373 Referrer-Policy: - same-origin X-Content-Type-Options: diff --git a/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_objects_api_v2.yaml b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_objects_api_v2.yaml index 1c5e9a6cee..5a38059fdd 100644 --- a/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_objects_api_v2.yaml +++ b/src/openforms/registrations/contrib/objects_api/tests/files/vcr_cassettes/ObjectsAPIBackendV2Tests/ObjectsAPIBackendV2Tests.test_submission_with_objects_api_v2.yaml @@ -2,8 +2,8 @@ interactions: - request: body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b", "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form - 000", "auteur": "Aanvrager", "taal": "nld", "formaat": "application/pdf", "inhoud": - "", "status": "definitief", "bestandsnaam": "open-forms-Form 000.pdf", "beschrijving": + 001", "auteur": "Aanvrager", "taal": "nld", "formaat": "application/pdf", "inhoud": + "", "status": "definitief", "bestandsnaam": "open-forms-Form 001.pdf", "beschrijving": "Ingezonden formulier", "indicatieGebruiksrecht": false, "bestandsomvang": 0}' headers: Accept: @@ -24,9 +24,9 @@ interactions: uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten response: body: - string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0c5dbf44-ed54-4b11-8974-4f7370a892c4","identificatie":"DOCUMENT-2024-0000000011","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form - 000","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"application/pdf","taal":"nld","versie":1,"beginRegistratie":"2024-03-19T13:40:44.807631Z","bestandsnaam":"open-forms-Form - 000.pdf","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0c5dbf44-ed54-4b11-8974-4f7370a892c4/download?versie=1","bestandsomvang":0,"link":"","beschrijving":"Ingezonden + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/990395a1-f75e-4c32-82a4-41d6175b07e1","identificatie":"DOCUMENT-2024-0000000025","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 001","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"application/pdf","taal":"nld","versie":1,"beginRegistratie":"2024-03-22T10:51:51.534858Z","bestandsnaam":"open-forms-Form + 001.pdf","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/990395a1-f75e-4c32-82a4-41d6175b07e1/download?versie=1","bestandsomvang":0,"link":"","beschrijving":"Ingezonden formulier","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/7a474713-0833-402a-8441-e467c08ac55b","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' headers: API-version: @@ -38,7 +38,7 @@ interactions: Content-Type: - application/json Location: - - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0c5dbf44-ed54-4b11-8974-4f7370a892c4 + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/990395a1-f75e-4c32-82a4-41d6175b07e1 Referrer-Policy: - same-origin Vary: @@ -55,9 +55,9 @@ interactions: - request: body: '{"informatieobjecttype": "http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3", "bronorganisatie": "000000000", "creatiedatum": "2024-03-19", "titel": "Form - 000 (csv)", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/csv", "inhoud": - "Rm9ybXVsaWVybmFhbSxJbnplbmRpbmdkYXR1bSxhZ2UsbGFzdG5hbWUsbG9jYXRpb24NCkZvcm0gMDAwLDIwMjQtMDMtMDMgMTg6MzQ6MzMuMzUwMDk2LDIwLE15IGxhc3QgbmFtZSwiWzUyLjM2NjczMzc4OTY3MTIyLCA0Ljg5MzE2NDI3NDQ3MDI5OV0iDQo=", - "status": "definitief", "bestandsnaam": "open-forms-Form 000 (csv).csv", "beschrijving": + 001 (csv)", "auteur": "Aanvrager", "taal": "nld", "formaat": "text/csv", "inhoud": + "Rm9ybXVsaWVybmFhbSxJbnplbmRpbmdkYXR1bSxhZ2UsbGFzdG5hbWUsbG9jYXRpb24NCkZvcm0gMDAxLDIwMjQtMDMtMTEgMTc6Mjc6NTEuNTg0NTAzLDIwLE15IGxhc3QgbmFtZSwiWzUyLjM2NjczMzc4OTY3MTIyLCA0Ljg5MzE2NDI3NDQ3MDI5OV0iDQo=", + "status": "definitief", "bestandsnaam": "open-forms-Form 001 (csv).csv", "beschrijving": "Ingezonden formulierdata", "indicatieGebruiksrecht": false, "bestandsomvang": 146}' headers: @@ -79,9 +79,9 @@ interactions: uri: http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten response: body: - string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/de312c5c-a423-4629-afd3-1adf9d7be55e","identificatie":"DOCUMENT-2024-0000000012","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form - 000 (csv)","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/csv","taal":"nld","versie":1,"beginRegistratie":"2024-03-19T13:40:44.854574Z","bestandsnaam":"open-forms-Form - 000 (csv).csv","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/de312c5c-a423-4629-afd3-1adf9d7be55e/download?versie=1","bestandsomvang":146,"link":"","beschrijving":"Ingezonden + string: '{"url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/e50ae1cc-86cb-4654-9634-c03d874ec92e","identificatie":"DOCUMENT-2024-0000000026","bronorganisatie":"000000000","creatiedatum":"2024-03-19","titel":"Form + 001 (csv)","vertrouwelijkheidaanduiding":"openbaar","auteur":"Aanvrager","status":"definitief","formaat":"text/csv","taal":"nld","versie":1,"beginRegistratie":"2024-03-22T10:51:51.582839Z","bestandsnaam":"open-forms-Form + 001 (csv).csv","inhoud":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/e50ae1cc-86cb-4654-9634-c03d874ec92e/download?versie=1","bestandsomvang":146,"link":"","beschrijving":"Ingezonden formulierdata","ontvangstdatum":null,"verzenddatum":null,"indicatieGebruiksrecht":false,"verschijningsvorm":"","ondertekening":{"soort":"","datum":null},"integriteit":{"algoritme":"","waarde":"","datum":null},"informatieobjecttype":"http://localhost:8003/catalogi/api/v1/informatieobjecttypen/b2d83b94-9b9b-4e80-a82f-73ff993c62f3","locked":false,"bestandsdelen":[],"trefwoorden":[],"lock":""}' headers: API-version: @@ -93,7 +93,7 @@ interactions: Content-Type: - application/json Location: - - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/de312c5c-a423-4629-afd3-1adf9d7be55e + - http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/e50ae1cc-86cb-4654-9634-c03d874ec92e Referrer-Policy: - same-origin Vary: @@ -110,9 +110,9 @@ interactions: - request: body: '{"type": "http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48", "record": {"typeVersion": 3, "data": {"age": 20, "name": {"last.name": "My last - name"}, "submission_date": "2024-03-19T13:40:34.222258+00:00", "submission_pdf_url": - "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0c5dbf44-ed54-4b11-8974-4f7370a892c4", - "submission_csv_url": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/de312c5c-a423-4629-afd3-1adf9d7be55e", + name"}, "submission_date": "2024-03-19T13:40:00+00:00", "submission_pdf_url": + "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/990395a1-f75e-4c32-82a4-41d6175b07e1", + "submission_csv_url": "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/e50ae1cc-86cb-4654-9634-c03d874ec92e", "submission_payment_completed": false, "submission_payment_amount": "0", "submission_payment_public_ids": []}, "startAt": "2024-03-19", "geometry": {"type": "Point", "coordinates": [52.36673378967122, 4.893164274470299]}}}' @@ -128,7 +128,7 @@ interactions: Content-Crs: - EPSG:4326 Content-Length: - - '725' + - '718' Content-Type: - application/json User-Agent: @@ -137,21 +137,21 @@ interactions: uri: http://localhost:8002/api/v2/objects response: body: - string: '{"url":"http://localhost:8002/api/v2/objects/8ce8a87a-da7b-45ca-8f17-10b491d5da1f","uuid":"8ce8a87a-da7b-45ca-8f17-10b491d5da1f","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My - last name"},"submission_date":"2024-03-19T13:40:34.222258+00:00","submission_pdf_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/0c5dbf44-ed54-4b11-8974-4f7370a892c4","submission_csv_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/de312c5c-a423-4629-afd3-1adf9d7be55e","submission_payment_completed":false,"submission_payment_amount":"0","submission_payment_public_ids":[]},"geometry":{"type":"Point","coordinates":[52.36673378967122,4.893164274470299]},"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-03-19","correctionFor":null,"correctedBy":null}}' + string: '{"url":"http://localhost:8002/api/v2/objects/5f064710-a3a2-447c-809d-1b8ee7051732","uuid":"5f064710-a3a2-447c-809d-1b8ee7051732","type":"http://objecttypes-web:8000/api/v2/objecttypes/8e46e0a5-b1b4-449b-b9e9-fa3cea655f48","record":{"index":1,"typeVersion":3,"data":{"age":20,"name":{"last.name":"My + last name"},"submission_date":"2024-03-19T13:40:00+00:00","submission_pdf_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/990395a1-f75e-4c32-82a4-41d6175b07e1","submission_csv_url":"http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/e50ae1cc-86cb-4654-9634-c03d874ec92e","submission_payment_completed":false,"submission_payment_amount":"0","submission_payment_public_ids":[]},"geometry":{"type":"Point","coordinates":[52.36673378967122,4.893164274470299]},"startAt":"2024-03-19","endAt":null,"registrationAt":"2024-03-22","correctionFor":null,"correctedBy":null}}' headers: Allow: - GET, POST, HEAD, OPTIONS Content-Crs: - EPSG:4326 Content-Length: - - '916' + - '909' Content-Type: - application/json Cross-Origin-Opener-Policy: - same-origin Location: - - http://localhost:8002/api/v2/objects/8ce8a87a-da7b-45ca-8f17-10b491d5da1f + - http://localhost:8002/api/v2/objects/5f064710-a3a2-447c-809d-1b8ee7051732 Referrer-Policy: - same-origin X-Content-Type-Options: diff --git a/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py b/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py index b722f633da..e30871dd65 100644 --- a/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py +++ b/src/openforms/registrations/contrib/objects_api/tests/test_backend_v2.py @@ -150,6 +150,7 @@ def test_submission_with_objects_api_v2(self): self.assertEqual( result["record"]["typeVersion"], v2_options["objecttype_version"] ) + submission_date = timezone.now().replace(second=0, microsecond=0).isoformat() self.assertEqual( result["record"]["data"], { @@ -162,7 +163,7 @@ def test_submission_with_objects_api_v2(self): "submission_payment_completed": False, "submission_payment_amount": "0", "submission_payment_public_ids": [], - "submission_date": timezone.now().isoformat(), + "submission_date": submission_date, }, ) self.assertEqual( @@ -199,11 +200,6 @@ def test_submission_with_file_components(self): file_name="attachment2_1.jpg", form_key="multiple_files", ) - SubmissionFileAttachmentFactory.create( - submission_step=submission_step, - file_name="attachment2_2.jpg", - form_key="multiple_files", - ) v2_options: RegistrationOptionsV2 = { "version": 2, @@ -242,4 +238,6 @@ def test_submission_with_file_components(self): "http://localhost:8003/documenten/api/v1/enkelvoudiginformatieobjecten/" ) ) - self.assertEqual(len(result["record"]["data"]["multiple_files"]), 2) + + self.assertIsInstance(result["record"]["data"]["multiple_files"], list) + self.assertEqual(len(result["record"]["data"]["multiple_files"]), 1) From 4445f0429c6eb841bf1183deafacfd14866fc34e Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Fri, 22 Mar 2024 11:55:43 +0100 Subject: [PATCH 11/13] [#3688] Adapt broken test --- .../submissions/tests/test_variables/test_num_queries.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openforms/submissions/tests/test_variables/test_num_queries.py b/src/openforms/submissions/tests/test_variables/test_num_queries.py index bda850a6fd..358743b795 100644 --- a/src/openforms/submissions/tests/test_variables/test_num_queries.py +++ b/src/openforms/submissions/tests/test_variables/test_num_queries.py @@ -129,7 +129,7 @@ def test_evaluate_form_logic_with_rules(self): # 7. Delete submission attachment files # 8. RELEASE SAVEPOINT # 9. Delete submission values - with self.assertNumQueries(9): + with self.assertNumQueries(6): evaluate_form_logic(submission, submission_step2, data) def test_update_step_data(self): From 4700eb1b79a17cb65f2e668b4eb0e0fc149c7baf Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 22 Mar 2024 13:10:47 +0100 Subject: [PATCH 12/13] :bug: [#3688] Properly access the 'formio-like' data Accessing dotted-keys like foo.bar in the underlying data structure used by FormioData does not work, the point of FormioData is to abstract this access. --- .../contrib/objects_api/submission_registration.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/openforms/registrations/contrib/objects_api/submission_registration.py b/src/openforms/registrations/contrib/objects_api/submission_registration.py index d208006a0d..94fc379c57 100644 --- a/src/openforms/registrations/contrib/objects_api/submission_registration.py +++ b/src/openforms/registrations/contrib/objects_api/submission_registration.py @@ -400,12 +400,7 @@ def get_object_data( } ) - variables_values = FormioData( - { - **dynamic_values, - **static_values, - } - ).data + variables_values = FormioData({**dynamic_values, **static_values}) variables_mapping = options["variables_mapping"] record_data: dict[str, JSONValue] = {} From 92b2832193037243c29d889d193dff814c55b6e1 Mon Sep 17 00:00:00 2001 From: Sergei Maertens Date: Fri, 22 Mar 2024 13:17:10 +0100 Subject: [PATCH 13/13] :bulb: [#3688] Update comments explaining which queries are running --- .../submissions/tests/test_variables/test_num_queries.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/openforms/submissions/tests/test_variables/test_num_queries.py b/src/openforms/submissions/tests/test_variables/test_num_queries.py index 358743b795..4b911dcfa8 100644 --- a/src/openforms/submissions/tests/test_variables/test_num_queries.py +++ b/src/openforms/submissions/tests/test_variables/test_num_queries.py @@ -125,10 +125,7 @@ def test_evaluate_form_logic_with_rules(self): # 4. Retrieve the submission variables to be deleted - deletion of data happens # because the step is marked N/A # 5. Retrieve the submission attachment files to be deleted - # 6. SAVEPOINT - # 7. Delete submission attachment files - # 8. RELEASE SAVEPOINT - # 9. Delete submission values + # 6. Delete submission values with self.assertNumQueries(6): evaluate_form_logic(submission, submission_step2, data)