From f5151ac5b577b50dacf55559662045fa46464fd3 Mon Sep 17 00:00:00 2001 From: Bart van der Schoor Date: Thu, 18 Apr 2024 10:25:06 +0200 Subject: [PATCH] [#2260] PR feedback: use statustekst instead of omschrijving in tests, add default value --- src/open_inwoner/openzaak/api_models.py | 4 +++- src/open_inwoner/openzaak/tests/test_notification_data.py | 2 +- src/open_inwoner/openzaak/tests/test_notification_utils.py | 2 +- src/open_inwoner/userfeed/tests/hooks/test_case_status.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/open_inwoner/openzaak/api_models.py b/src/open_inwoner/openzaak/api_models.py index 837b5a4ab2..83bde4f344 100644 --- a/src/open_inwoner/openzaak/api_models.py +++ b/src/open_inwoner/openzaak/api_models.py @@ -4,6 +4,8 @@ from datetime import date, datetime from typing import Optional, Union +from django.utils.translation import gettext as _ + from dateutil.relativedelta import relativedelta from zgw_consumers.api_models.base import Model, ZGWModel from zgw_consumers.api_models.constants import RolOmschrijving, RolTypes @@ -87,7 +89,7 @@ def process_data(self) -> dict: ), default="", ) - status_text = result_text or status_text + status_text = result_text or status_text or _("No data available") return { "identification": self.identification, diff --git a/src/open_inwoner/openzaak/tests/test_notification_data.py b/src/open_inwoner/openzaak/tests/test_notification_data.py index 03e0c6a277..31c36ceb06 100644 --- a/src/open_inwoner/openzaak/tests/test_notification_data.py +++ b/src/open_inwoner/openzaak/tests/test_notification_data.py @@ -84,7 +84,7 @@ def __init__(self): informeren=True, volgnummer=2, omschrijving="final", - statustekst="", + statustekst="status_type_final_statustekst", isEindStatus=True, ) self.zaak = generate_oas_component_cached( diff --git a/src/open_inwoner/openzaak/tests/test_notification_utils.py b/src/open_inwoner/openzaak/tests/test_notification_utils.py index 783a3530a8..07782f43df 100644 --- a/src/open_inwoner/openzaak/tests/test_notification_utils.py +++ b/src/open_inwoner/openzaak/tests/test_notification_utils.py @@ -60,7 +60,7 @@ def test_send_case_update_email(self): body_html = email.alternatives[0][0] self.assertIn(case.identificatie, body_html) self.assertIn(case.zaaktype.omschrijving, body_html) - self.assertIn(status.statustype.omschrijving, body_html) + self.assertIn(status.statustype.statustekst, body_html) self.assertIn(case_url, body_html) self.assertIn(config.name, body_html) diff --git a/src/open_inwoner/userfeed/tests/hooks/test_case_status.py b/src/open_inwoner/userfeed/tests/hooks/test_case_status.py index 241b434d44..c190dad517 100644 --- a/src/open_inwoner/userfeed/tests/hooks/test_case_status.py +++ b/src/open_inwoner/userfeed/tests/hooks/test_case_status.py @@ -92,7 +92,7 @@ def test_status_update(self, mock_get_active_app_names: Mock): strip_tags(item.message), escape( _("Case status has been changed to '{status}'").format( - status=status2.statustype.omschrijving + status=status2.statustype.statustekst ) ), )