diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-11 19:18:23 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-11 19:18:23 +0100 |
commit | 851017203f9962c2d9bd2f483e736ef88ef8f8aa (patch) | |
tree | 1367b696f285596fea23aff300524468c2d7aaef /ctrack/register/tests | |
parent | 65b22a3bd3f392422fb2ec9fffc51b70d20cc5aa (diff) |
improved tests - more consistent and added a case
Diffstat (limited to 'ctrack/register/tests')
-rw-r--r-- | ctrack/register/tests/test_event_models.py | 27 | ||||
-rw-r--r-- | ctrack/register/tests/test_forms.py | 7 |
2 files changed, 16 insertions, 18 deletions
diff --git a/ctrack/register/tests/test_event_models.py b/ctrack/register/tests/test_event_models.py index b4e133e..4c4d77c 100644 --- a/ctrack/register/tests/test_event_models.py +++ b/ctrack/register/tests/test_event_models.py @@ -12,10 +12,19 @@ from ctrack.register.models import ( pytestmark = pytest.mark.django_db -def test_caf_initial_caf_received(user, caf): +@pytest.mark.parametrize( + "allowed_type", + [ + "CAF_INITIAL_CAF_RECEIVED", + "CAF_FEEDBACK_EMAILED_OES", + "CAF_RECEIVED", + "CAF_EMAILED_ROSA", + ], +) +def test_caf_single_date_events(allowed_type, user, caf): now = datetime.datetime.now() e = CAFSingleDateEvent.objects.create( - type_descriptor="CAF_INITIAL_CAF_RECEIVED", + type_descriptor=allowed_type, related_caf=caf, short_description="CAF received for X Company", date="2020-10-10", @@ -23,6 +32,7 @@ def test_caf_initial_caf_received(user, caf): user=user, ) assert e.created_date.day == now.day + assert e.type_descriptor == allowed_type def test_cannot_add_two_caf_initial_caf_received_events_on_same_date(user, caf): @@ -45,19 +55,6 @@ def test_cannot_add_two_caf_initial_caf_received_events_on_same_date(user, caf): ) -def test_caf_initial_caf_emailed_rosa(user, caf): - now = datetime.datetime.now() - e = CAFSingleDateEvent.objects.create( - type_descriptor="CAF_EMAILED_ROSA", - related_caf=caf, - short_description="CAF sent to Rosa for X Company", - date="2020-10-10", - comments="Nice comments for this event", - user=user, - ) - assert e.created_date.day == now.day - - def test_can_email_two_caf_on_same_date(user, caf): CAFSingleDateEvent.objects.create( type_descriptor="CAF_EMAILED_ROSA", diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py index 572b8f8..7bb12a5 100644 --- a/ctrack/register/tests/test_forms.py +++ b/ctrack/register/tests/test_forms.py @@ -62,9 +62,10 @@ def test_meeting_blank_data(user): @pytest.mark.parametrize( "allowed_type", [ - ("CAF_INITIAL_CAF_RECEIVED"), - ("CAF_RECEIVED"), - ("CAF_EMAILED_ROSA"), + "CAF_INITIAL_CAF_RECEIVED", + "CAF_RECEIVED", + "CAF_FEEDBACK_EMAILED_OES", + "CAF_EMAILED_ROSA", ], ) def test_allowable_caf_single_date_event_forms(allowed_type, user, caf): |