From ae872e474f5f6d388161759d242ea871dc2bd20b Mon Sep 17 00:00:00 2001 From: juuso-j Date: Mon, 18 Mar 2024 10:39:21 +0200 Subject: [PATCH] Test blur count --- profiles/tests/api/test_postal_code_result.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/profiles/tests/api/test_postal_code_result.py b/profiles/tests/api/test_postal_code_result.py index 358b378..faad275 100644 --- a/profiles/tests/api/test_postal_code_result.py +++ b/profiles/tests/api/test_postal_code_result.py @@ -10,6 +10,21 @@ ANSWER_URL = reverse("profiles:answer-list") +@pytest.mark.django_db +def test_blur_count(api_client, results): + postal_code_result = PostalCodeResult.objects.create( + count=5, result=results.first() + ) + url = reverse("profiles:postalcoderesult-detail", args=[str(postal_code_result.id)]) + response = api_client.get(url) + assert response.status_code == 200 + assert response.json()["count"] == 0 + postal_code_result.count = 6 + postal_code_result.save() + response = api_client.get(url) + assert response.json()["count"] == 6 + + @pytest.mark.django_db def test_postal_code_result_with_postal_code_and_optional_postal_code( api_client, users, questions, options, results