From 7054db50c4a50b5cb59299fcb8d0254c2f7e2365 Mon Sep 17 00:00:00 2001 From: DonHaul Date: Tue, 27 Aug 2024 17:27:45 +0200 Subject: [PATCH] backoffice: fix restart with params * ref: cern-sis/issues-inspire/issues/545 --- .../backoffice/workflows/tests/test_views.py | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/backoffice/backoffice/workflows/tests/test_views.py b/backoffice/backoffice/workflows/tests/test_views.py index 0f6ff9a5..9b24b8d3 100644 --- a/backoffice/backoffice/workflows/tests/test_views.py +++ b/backoffice/backoffice/workflows/tests/test_views.py @@ -11,6 +11,7 @@ from django.test import TransactionTestCase from django.urls import reverse from django_opensearch_dsl.registries import registry +from parameterized import parameterized from rest_framework import status from rest_framework.test import APIClient @@ -492,7 +493,7 @@ def setUpClass(cls): ], "name": {"value": "Smith, John", "preferred_name": "John Smith"}, "email_addresses": [ - {"value": "john.smith@someting.ch", "current": True} + {"value": "john.smith@something.ch", "current": True} ], }, status=StatusChoices.RUNNING, @@ -516,10 +517,26 @@ def test_search_data_name(self): response = self.api_client.get(url) results = response.json()["results"] - assert len(results) == 1 assert results[0]["data"]["name"]["value"] == "Smith, John" + @parameterized.expand(("john.smith@something.ch",)) + def test_search_data_email(self, email): + self.api_client.force_authenticate(user=self.admin) + + url = reverse("search:workflow-list") + + urls = [ + url + f"?search={email}", + url + f"?search=data.email_addresses.value:{email}", + ] + + for url in urls: + response = self.api_client.get(url) + results = response.json()["results"] + assert len(results) == 1 + assert results[0]["data"]["email_addresses"][0]["value"] == email + def test_filter_status(self): self.api_client.force_authenticate(user=self.admin)