aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/tests
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-16 11:05:42 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-16 11:05:42 +0100
commiteb8497dcd3758d20447d4de977780c2c78a38613 (patch)
treef5c188ad01ac8db9156db587c821706396671100 /ctrack/register/tests
parentc0067e3dd35f56ad0cf9452f9ef1e8532b6378b4 (diff)
Improvements to simple event form.
Diffstat (limited to '')
-rw-r--r--ctrack/register/tests/test_forms.py16
-rw-r--r--ctrack/register/tests/test_models.py (renamed from ctrack/register/tests/test_event_models.py)15
2 files changed, 31 insertions, 0 deletions
diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py
index ac21abb..2307a20 100644
--- a/ctrack/register/tests/test_forms.py
+++ b/ctrack/register/tests/test_forms.py
@@ -60,6 +60,22 @@ def test_create_simple_datetime_event(user):
assert form.is_valid()
+def test_create_private_note(user):
+ form = CreateSimpleDateTimeEventForm(
+ {
+ "type_descriptor": "NOTE",
+ "short_description": "Test Short Description",
+ "datetime": "2010-10-10 10:00",
+ "requested_response_date": "2020-12-24",
+ "response_received_date": "2020-12-25",
+ "url": "https://fake.url.com",
+ "private": True,
+ "comments": "Test Comments not needed"
+ }, user=user,
+ )
+ assert form.is_valid()
+
+
def test_response_date_cannot_be_before_date(user):
form = CreateSimpleDateTimeEventForm(
{
diff --git a/ctrack/register/tests/test_event_models.py b/ctrack/register/tests/test_models.py
index e92b282..1f8923b 100644
--- a/ctrack/register/tests/test_event_models.py
+++ b/ctrack/register/tests/test_models.py
@@ -150,6 +150,7 @@ def test_event_type_enum():
assert EventType.PHONE_CALL.name == "PHONE_CALL"
assert EventType.VIDEO_CALL.name == "VIDEO_CALL"
assert EventType.EMAIL.name == "EMAIL"
+ assert EventType.NOTE.name == "NOTE"
assert EventType.CAF_INITIAL_CAF_RECEIVED.name == "CAF_INITIAL_CAF_RECEIVED"
assert EventType.CAF_FEEDBACK_EMAILED_OES.name == "CAF_FEEDBACK_EMAILED_OES"
assert EventType.CAF_RECEIVED.name == "CAF_RECEIVED"
@@ -217,3 +218,17 @@ def test_meeting_event(user, person):
assert e.user.name == uname
assert e.created_date.day == now.day
assert e.modified_date.day == now.day
+
+
+@pytest.mark.parametrize("allowed_type", ["NOTE"])
+def test_note_event(user, allowed_type):
+ e = SingleDateTimeEvent.objects.create(
+ type_descriptor=allowed_type,
+ short_description="Test short description",
+ datetime="2020-10-10 10:30",
+ comments="The guy I deal with at X Co Ltd is made of cheese,",
+ url="https://evidenceofcheese.com",
+ private=True,
+ user=user
+ )
+ assert e.type_descriptor == allowed_type