From 252d1e3a5618997a45aa31e9dfcf4f6e31eaabcc Mon Sep 17 00:00:00 2001 From: Juha Louhiranta Date: Wed, 21 Aug 2024 09:59:15 +0300 Subject: [PATCH] test: add separate test for unvoting without authentication Refs: KER-368 --- democracy/tests/integrationtest/test_comment_vote.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/democracy/tests/integrationtest/test_comment_vote.py b/democracy/tests/integrationtest/test_comment_vote.py index 418288b9..cc42e614 100644 --- a/democracy/tests/integrationtest/test_comment_vote.py +++ b/democracy/tests/integrationtest/test_comment_vote.py @@ -98,10 +98,8 @@ def test_31_section_comment_vote_add_second_vote(john_doe_api_client, default_he @pytest.mark.django_db -def test_section_comment_unvote(api_client, john_doe_api_client, default_hearing): +def test_section_comment_unvote(john_doe_api_client, default_hearing): section, comment = add_default_section_and_comment(default_hearing) - response = api_client.post(get_section_comment_unvote_url(default_hearing.id, section.id, comment.id)) - assert response.status_code == 403 john_doe_api_client.post(get_section_comment_vote_url(default_hearing.id, section.id, comment.id)) response = john_doe_api_client.post(get_section_comment_unvote_url(default_hearing.id, section.id, comment.id)) @@ -114,6 +112,13 @@ def test_section_comment_unvote(api_client, john_doe_api_client, default_hearing assert response.status_code == 304 +@pytest.mark.django_db +def test_section_comment_unvote_without_authentication(api_client, default_hearing): + section, comment = add_default_section_and_comment(default_hearing) + response = api_client.post(get_section_comment_unvote_url(default_hearing.id, section.id, comment.id)) + assert response.status_code == 403 + + @pytest.mark.django_db def test_vote_appears_in_user_data(john_doe_api_client, default_hearing): section, sc_comment = add_default_section_and_comment(default_hearing)