aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/tests/test_event_models.py
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-11 19:44:36 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-11 19:44:36 +0100
commit392ed6017ab01250c1748bd0f2717d8db554115d (patch)
tree7d6152f9e640363dfae05b186f64d8acf552f7aa /ctrack/register/tests/test_event_models.py
parent721c0e7e3056d6e14499b807cdc2837505c5ca18 (diff)
test for integrityerror when trying to create CAFTwinDateEvent with no start_date
Diffstat (limited to '')
-rw-r--r--ctrack/register/tests/test_event_models.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/ctrack/register/tests/test_event_models.py b/ctrack/register/tests/test_event_models.py
index 678d8b5..702ca27 100644
--- a/ctrack/register/tests/test_event_models.py
+++ b/ctrack/register/tests/test_event_models.py
@@ -54,6 +54,30 @@ 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):
+ e = CAFTwinDateEvent.objects.create(
+ type_descriptor="CAF_PEER_REVIEW_PERIOD",
+ related_caf=caf,
+ short_description="CAF received for X Company",
+ start_date="2020-10-10",
+ comments="Nice comments for this event",
+ user=user,
+ )
+ assert e.end_date is None
+
+
+def test_caf_twin_date_event_no_start_date_not_allowed(user, caf):
+ with pytest.raises(IntegrityError):
+ CAFTwinDateEvent.objects.create(
+ type_descriptor="CAF_PEER_REVIEW_PERIOD",
+ related_caf=caf,
+ short_description="CAF received for X Company",
+ end_date="2020-10-10",
+ comments="Nice comments for this event",
+ user=user,
+ )
+
+
def test_cannot_add_two_caf_initial_caf_received_events_on_same_date(user, caf):
CAFSingleDateEvent.objects.create(
type_descriptor="CAF_INITIAL_CAF_RECEIVED",