Skip to content

Commit

Permalink
[#2681] Add captcha tag to some tests
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
pbanaszkiewicz committed Aug 4, 2024
1 parent fdc9457 commit c71ea5d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions amy/extforms/tests/test_selforganised_submission_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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."""
Expand Down
6 changes: 5 additions & 1 deletion amy/extforms/tests/test_training_request_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions amy/extforms/tests/test_workshop_inquiry_form.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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."""
Expand Down
2 changes: 2 additions & 0 deletions amy/extforms/tests/test_workshop_request_form.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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."""
Expand Down

0 comments on commit c71ea5d

Please sign in to comment.