aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/tests
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-12 12:08:54 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-12 12:08:54 +0100
commit7db4392801aca82d1dec6eb57abf7cb74c10689c (patch)
tree3c6a5a565c0c5f7b76568e9c574b83fd0730e719 /ctrack/register/tests
parent392ed6017ab01250c1748bd0f2717d8db554115d (diff)
more tests using parameterization
Diffstat (limited to '')
-rw-r--r--ctrack/register/tests/test_event_models.py16
-rw-r--r--ctrack/register/tests/test_forms.py12
2 files changed, 21 insertions, 7 deletions
diff --git a/ctrack/register/tests/test_event_models.py b/ctrack/register/tests/test_event_models.py
index 702ca27..39b501c 100644
--- a/ctrack/register/tests/test_event_models.py
+++ b/ctrack/register/tests/test_event_models.py
@@ -20,6 +20,8 @@ pytestmark = pytest.mark.django_db
"CAF_FEEDBACK_EMAILED_OES",
"CAF_RECEIVED",
"CAF_EMAILED_ROSA",
+ "CAF_VALIDATION_SIGN_OFF",
+ "CAF_VALIDATION_RECORD_EMAILED_TO_OES",
],
)
def test_caf_single_date_events(allowed_type, user, caf):
@@ -54,9 +56,12 @@ def test_caf_twin_date_events(allowed_type, user, caf):
assert e.type_descriptor == allowed_type
-def test_caf_twin_date_event_no_end_date(user, caf):
+@pytest.mark.parametrize(
+ "allowed_type", ["CAF_PEER_REVIEW_PERIOD", "CAF_VALIDATION_PERIOD"]
+)
+def test_caf_twin_date_event_no_end_date(allowed_type, user, caf):
e = CAFTwinDateEvent.objects.create(
- type_descriptor="CAF_PEER_REVIEW_PERIOD",
+ type_descriptor=allowed_type,
related_caf=caf,
short_description="CAF received for X Company",
start_date="2020-10-10",
@@ -66,10 +71,13 @@ def test_caf_twin_date_event_no_end_date(user, caf):
assert e.end_date is None
-def test_caf_twin_date_event_no_start_date_not_allowed(user, caf):
+@pytest.mark.parametrize(
+ "allowed_type", ["CAF_PEER_REVIEW_PERIOD", "CAF_VALIDATION_PERIOD"]
+)
+def test_caf_twin_date_event_no_start_date_not_allowed(allowed_type, user, caf):
with pytest.raises(IntegrityError):
CAFTwinDateEvent.objects.create(
- type_descriptor="CAF_PEER_REVIEW_PERIOD",
+ type_descriptor=allowed_type,
related_caf=caf,
short_description="CAF received for X Company",
end_date="2020-10-10",
diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py
index 7bb12a5..9dd7437 100644
--- a/ctrack/register/tests/test_forms.py
+++ b/ctrack/register/tests/test_forms.py
@@ -66,6 +66,8 @@ def test_meeting_blank_data(user):
"CAF_RECEIVED",
"CAF_FEEDBACK_EMAILED_OES",
"CAF_EMAILED_ROSA",
+ "CAF_VALIDATION_SIGN_OFF",
+ "CAF_VALIDATION_RECORD_EMAILED_TO_OES",
],
)
def test_allowable_caf_single_date_event_forms(allowed_type, user, caf):
@@ -82,10 +84,14 @@ def test_allowable_caf_single_date_event_forms(allowed_type, user, caf):
assert form.is_valid()
-def test_cannot_create_two_caf_initial_receipt_events_on_same_day(user, caf):
+@pytest.mark.parametrize(
+ "allowed_type",
+ ["CAF_INITIAL_CAF_RECEIVED", "CAF_VALIDATION_SIGN_OFF", "CAF_RECEIVED"],
+)
+def test_cannot_do_some_caf_single_date_events_on_same_day(allowed_type, user, caf):
form1 = CAFSingleDateEventForm(
{
- "type_descriptor": "CAF_INITIAL_CAF_RECEIVED",
+ "type_descriptor": allowed_type,
"related_caf": caf,
"short_description": "Test Short Description",
"date": "2010-07-01",
@@ -95,7 +101,7 @@ def test_cannot_create_two_caf_initial_receipt_events_on_same_day(user, caf):
)
form2 = CAFSingleDateEventForm(
{
- "type_descriptor": "CAF_INITIAL_CAF_RECEIVED",
+ "type_descriptor": allowed_type,
"related_caf": caf,
"short_description": "Test Short Description",
"date": "2010-07-01",