diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-11 16:25:12 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-11 16:25:12 +0100 |
commit | 24ea3fbd45503ca3fcfcac0bacb399af772c520b (patch) | |
tree | d784d289aac78bd5441ec04a8db0be1fef18233e /ctrack/register/tests/test_event_models.py | |
parent | 777372e75bc46fa60e68afcf185642ed38d57e5c (diff) |
some more options in AVAILABLE_TYPES
Diffstat (limited to 'ctrack/register/tests/test_event_models.py')
-rw-r--r-- | ctrack/register/tests/test_event_models.py | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/ctrack/register/tests/test_event_models.py b/ctrack/register/tests/test_event_models.py index 4d72d22..225aa4d 100644 --- a/ctrack/register/tests/test_event_models.py +++ b/ctrack/register/tests/test_event_models.py @@ -60,8 +60,7 @@ def test_caf_initial_caf_emailed_rosa(user, caf): def test_can_email_two_caf_on_same_date(user, caf): - now = datetime.datetime.now() - e1 = CAFSingleDateEvent.objects.create( + CAFSingleDateEvent.objects.create( type_descriptor="CAF_EMAILED_ROSA", related_caf=caf, short_description="CAF sent to Rosa for X Company", @@ -69,16 +68,34 @@ def test_can_email_two_caf_on_same_date(user, caf): comments="Nice comments for this event", user=user, ) - e2 = CAFSingleDateEvent.objects.create( - type_descriptor="CAF_INITIAL_CAF_EMAILED_ROSA", + 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 e1.created_date.day == now.day - assert e2.created_date.day == now.day + + +def test_cannot_receive_the_same_caf_on_the_same_day(user, caf): + CAFSingleDateEvent.objects.create( + type_descriptor="CAF_RECEIVED", + related_caf=caf, + short_description="CAF received to Rosa for X Company", + date="2020-10-10", + comments="Nice comments for this event", + user=user, + ) + with pytest.raises(IntegrityError): + CAFSingleDateEvent.objects.create( + type_descriptor="CAF_RECEIVED", + related_caf=caf, + short_description="CAF received to Rosa for X Company", + date="2020-10-10", + comments="Nice comments for this event", + user=user, + ) def test_event_type_enum(): |