Skip to content

Commit

Permalink
✅ [#1797] Fix tests for document upload success msg
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenbal committed Nov 9, 2023
1 parent 7787d08 commit 136638f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/open_inwoner/openzaak/tests/test_case_detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def setUpTestData(cls):
vertrouwelijkheidaanduiding=VertrouwelijkheidsAanduidingen.openbaar,
bestandsnaam="upload.txt",
bestandsomvang=123,
titel="uploaded file",
)

cls.zaak_informatie_object_invisible = generate_oas_component(
Expand Down Expand Up @@ -905,8 +906,8 @@ def test_successful_document_upload_flow(self, m):

self.assertEqual(
redirect_messages[0].message,
_(
f"{self.uploaded_informatie_object['bestandsnaam']} is succesvol geüpload"
_("Wij hebben **1 bestand(en)** succesvol geüpload:\n\n- {title}").format(
title="uploaded file"
),
)

Expand Down Expand Up @@ -942,10 +943,18 @@ def test_successful_document_upload_flow_with_uppercase_extension(self, m):

redirect = self.app.get(form_response.headers["HX-Redirect"])
redirect_messages = list(redirect.context["messages"])
upload_request = next(
request
for request in m.request_history
if request.url == f"{DOCUMENTEN_ROOT}enkelvoudiginformatieobjecten"
)

self.assertEqual(upload_request.json()["bestandsnaam"], "upload.TXT")
self.assertEqual(
redirect_messages[0].message,
_("upload.TXT is succesvol geüpload"),
_("Wij hebben **1 bestand(en)** succesvol geüpload:\n\n- {title}").format(
title="uploaded file"
),
)

def test_upload_file_flow_fails_with_invalid_file_extension(self, m):
Expand Down

0 comments on commit 136638f

Please sign in to comment.