Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(Activités des structures): Passage du formulaire "Votre référencement" en lecture seule #1498

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions lemarche/www/siaes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ def setUpTestData(cls):

def test_search_num_queries(self):
url = reverse("siae:search_results")

# fix cache issue in parallel testing context, "SELECT 'django_site'" query appears additionally otherwise
self.client.get(url)
SebastienReuiller marked this conversation as resolved.
Show resolved Hide resolved

with self.assertNumQueries(12):
response = self.client.get(url)
siaes = list(response.context["siaes"])
Expand Down Expand Up @@ -1032,11 +1036,14 @@ def test_search_query_no_result(self):
mock_siaes_similarity_search.assert_called_once()

def test_search_query_with_results(self):
with mock.patch(
"lemarche.utils.apis.api_elasticsearch.siaes_similarity_search"
) as mock_siaes_similarity_search, mock.patch(
"lemarche.utils.apis.api_elasticsearch.siaes_similarity_search_with_city"
) as mock_siaes_similarity_search_with_city:
with (
mock.patch(
"lemarche.utils.apis.api_elasticsearch.siaes_similarity_search"
) as mock_siaes_similarity_search,
mock.patch(
"lemarche.utils.apis.api_elasticsearch.siaes_similarity_search_with_city"
) as mock_siaes_similarity_search_with_city,
):
mock_siaes_similarity_search.return_value = [self.siae_two.pk, self.siae_three.pk, self.siae_four.pk]
url = self.url + "?semantic_q=entretien espace vert&id_semantic_city_name=&semantic_city="
response = self.client.get(url)
Expand Down