Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request #100 from DonHaul/search-improvement-simple
Browse files Browse the repository at this point in the history
fixed email string
  • Loading branch information
DonHaul authored Sep 2, 2024
2 parents 61aa049 + 8648a6b commit 330505d
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
17 changes: 15 additions & 2 deletions backoffice/backoffice/workflows/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -490,7 +491,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,
Expand All @@ -514,10 +515,22 @@ 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(["?search=", "?search=data.email_addresses.value:"])
def test_search_data_email(self, query_params):
self.api_client.force_authenticate(user=self.admin)

email = "[email protected]"

url = reverse("search:workflow-list") + f"{query_params}{email}"

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)

Expand Down
16 changes: 15 additions & 1 deletion backoffice/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backoffice/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ django-coverage-plugin = "3.1.0"
pytest-django = "4.5.2"
pytest-vcr = "^1.0.2"
vcrpy = "^6.0.1"
parameterized = "^0.9.0"

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit 330505d

Please sign in to comment.