Skip to content

Commit

Permalink
add test for when enforcement is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
elichad committed Oct 24, 2023
1 parent a470da2 commit a041201
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions amy/extrequests/tests/test_workshop_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,21 @@ def setUpMembership(self):
registration_code="valid123",
)

@override_settings(FLAGS={"ENFORCE_MEMBER_CODES": [("boolean", False)]})
def test_member_code_validation__not_enforced(self):
"""Invalid code should pass if enforcement is not enabled."""
# Arrange
data = {
"member_code": "invalid",
}

# Act
rv = self.client.post(reverse("training_request"), data=data)

# Assert
self.assertEqual(rv.status_code, 200)
self.assertNotContains(rv, self.INVALID_CODE_ERROR)

@override_settings(FLAGS={"ENFORCE_MEMBER_CODES": [("boolean", True)]})
def test_member_code_validation__code_valid(self):
"""valid code - no error"""
Expand Down

0 comments on commit a041201

Please sign in to comment.