From c71ea5ddb0e0dc6d53d7946eea70414c603d5ede Mon Sep 17 00:00:00 2001 From: Piotr Banaszkiewicz Date: Sun, 4 Aug 2024 23:52:49 +0200 Subject: [PATCH] [#2681] Add `captcha` tag to some tests I was running tests with no internet connection. These tests failed due to missing network. In cases like that the test suite can be run without them by using `--exclude-tags captcha`. --- amy/extforms/tests/test_selforganised_submission_form.py | 2 ++ amy/extforms/tests/test_training_request_form.py | 6 +++++- amy/extforms/tests/test_workshop_inquiry_form.py | 2 ++ amy/extforms/tests/test_workshop_request_form.py | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/amy/extforms/tests/test_selforganised_submission_form.py b/amy/extforms/tests/test_selforganised_submission_form.py index d7a9e1650..0237f3e60 100644 --- a/amy/extforms/tests/test_selforganised_submission_form.py +++ b/amy/extforms/tests/test_selforganised_submission_form.py @@ -2,6 +2,7 @@ from django.conf import settings from django.core import mail +from django.test import tag from django.urls import reverse from extforms.forms import SelfOrganisedSubmissionExternalForm @@ -49,6 +50,7 @@ def test_fields_presence(self): ) self.assertEqual(fields_left, fields_right) + @tag("captcha") def test_request_added(self): """Ensure the request is successfully added to the pool, and notification email is sent.""" diff --git a/amy/extforms/tests/test_training_request_form.py b/amy/extforms/tests/test_training_request_form.py index 51a1d4369..8d4d3c7a9 100644 --- a/amy/extforms/tests/test_training_request_form.py +++ b/amy/extforms/tests/test_training_request_form.py @@ -4,7 +4,7 @@ from django.conf import settings from django.core import mail from django.forms import CheckboxInput, HiddenInput -from django.test import override_settings +from django.test import override_settings, tag from django.urls import reverse from consents.models import Term, TermOptionChoices @@ -111,6 +111,7 @@ def add_terms_to_payload(self) -> dict[str, int]: data[term.slug] = option.pk return data + @tag("captcha") @override_settings(FLAGS={"ENFORCE_MEMBER_CODES": [("boolean", False)]}) def test_request_added(self): # Arrange @@ -139,6 +140,7 @@ def test_request_added(self): settings.TEMPLATES[0]["OPTIONS"]["string_if_invalid"], msg.body ) + @tag("captcha") def test_invalid_request_not_added(self): # Arrange self.data.pop("personal") # remove a required field @@ -417,6 +419,7 @@ def test_member_code_validation__code_valid_override(self): HiddenInput, ) + @tag("captcha") @override_settings(FLAGS={"ENFORCE_MEMBER_CODES": [("boolean", True)]}) def test_member_code_validation__code_valid_override_full_request(self): """Override should be quietly changed to False if a valid code is used @@ -448,6 +451,7 @@ def test_member_code_validation__code_valid_override_full_request(self): settings.TEMPLATES[0]["OPTIONS"]["string_if_invalid"], msg.body ) + @tag("captcha") def test_member_code_validation__code_invalid_override_full_request(self): """Sent email should include the member_code_override field if used.""" # Arrange diff --git a/amy/extforms/tests/test_workshop_inquiry_form.py b/amy/extforms/tests/test_workshop_inquiry_form.py index b4e1e6cec..a3e0bd005 100644 --- a/amy/extforms/tests/test_workshop_inquiry_form.py +++ b/amy/extforms/tests/test_workshop_inquiry_form.py @@ -1,5 +1,6 @@ from django.conf import settings from django.core import mail +from django.test import tag from django.urls import reverse from extforms.forms import WorkshopInquiryRequestExternalForm @@ -61,6 +62,7 @@ def test_fields_presence(self): ) self.assertEqual(fields_left, fields_right) + @tag("captcha") def test_request_added(self): """Ensure the request is successfully added to the pool, and notification email is sent.""" diff --git a/amy/extforms/tests/test_workshop_request_form.py b/amy/extforms/tests/test_workshop_request_form.py index becfc3524..9eaa2a8a3 100644 --- a/amy/extforms/tests/test_workshop_request_form.py +++ b/amy/extforms/tests/test_workshop_request_form.py @@ -1,5 +1,6 @@ from django.conf import settings from django.core import mail +from django.test import tag from django.urls import reverse from extforms.forms import WorkshopRequestExternalForm @@ -56,6 +57,7 @@ def test_fields_presence(self): ) self.assertEqual(fields_left, fields_right) + @tag("captcha") def test_request_added(self): """Ensure the request is successfully added to the pool, and notification email is sent."""