Skip to content

Commit

Permalink
[#4009] Remove tests related to merged data
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Apr 3, 2024
1 parent afebb3b commit 88d411b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 45 deletions.
28 changes: 28 additions & 0 deletions src/openforms/submissions/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,31 @@ def get_component(submission, registration_attribute: str, component_attribute:
attribute = glom(component, component_attribute, default=None)
if attribute == registration_attribute:
return component


from typing import Annotated, TypeVar

T = TypeVar("T")


def field(default_factory):
return default_factory

Check warning on line 175 in src/openforms/submissions/mapping.py

View check run for this annotation

Codecov / codecov/patch

src/openforms/submissions/mapping.py#L175

Added line #L175 was not covered by tests


WithDefaultFactory = Annotated[T, ...]


class Impl:
def __class_getitem__(cls, arg):
return Annotated[arg, field(default_factory=int)]

Check warning on line 183 in src/openforms/submissions/mapping.py

View check run for this annotation

Codecov / codecov/patch

src/openforms/submissions/mapping.py#L183

Added line #L183 was not covered by tests


from dataclasses import dataclass


@dataclass
class A:
el: WithDefaultFactory[int]


A(el=1)
46 changes: 1 addition & 45 deletions src/openforms/submissions/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
from maykin_2fa.test import disable_admin_mfa

from openforms.accounts.tests.factories import UserFactory
from openforms.forms.models import FormVariable
from openforms.logging.logevent import submission_start
from openforms.logging.models import TimelineLogProxy

from ...config.models import GlobalConfiguration
from ..constants import PostSubmissionEvents, RegistrationStatuses
from .factories import SubmissionFactory, SubmissionValueVariableFactory
from .factories import SubmissionFactory


@disable_admin_mfa()
Expand Down Expand Up @@ -42,49 +41,6 @@ def setUp(self):
super().setUp()
self.user = UserFactory.create(is_superuser=True, is_staff=True)

def test_displaying_merged_data_formio_formatters(self):
response = self.app.get(
reverse(
"admin:submissions_submission_change", args=(self.submission_1.pk,)
),
user=self.user,
)
expected = """
<ul>
<li>adres: Voorburg</li>
<li>voornaam: shea</li>
<li>familienaam: meyers</li>
<li>geboortedatum: None</li>
<li>signature: None</li>
</ul>
"""

self.assertContains(response, expected, html=True)

def test_displaying_merged_data_displays_signature_as_image_formio_formatters(self):
form_variable = FormVariable.objects.get(
key="signature", form=self.submission_1.form
)
SubmissionValueVariableFactory.create(
key="signature",
submission=self.submission_1,
value="data:image/png;base64,iVBOR",
form_variable=form_variable,
)

response = self.app.get(
reverse(
"admin:submissions_submission_change", args=(self.submission_1.pk,)
),
user=self.user,
)

self.assertContains(
response,
"<li>signature: <img class='signature-image' src='data:image/png;base64,iVBOR' alt='signature'></li>",
html=True,
)

def test_viewing_submission_details_in_admin_creates_log(self):
self.app.get(
reverse(
Expand Down

0 comments on commit 88d411b

Please sign in to comment.