aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/register/tests
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-11 12:12:25 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-11 12:12:25 +0100
commit1f47b102acd45129bf8e96713af5dc6265ba2873 (patch)
treefccae0f08f178fe942e5faea5309a9a3065cca4b /ctrack/register/tests
parent5150b4e0847f5edf15ef2fd6b42b3ca6b55bc6fa (diff)
working through mixins model design
Diffstat (limited to '')
-rw-r--r--ctrack/register/tests/test_events.py34
-rw-r--r--ctrack/register/tests/test_forms.py3
2 files changed, 34 insertions, 3 deletions
diff --git a/ctrack/register/tests/test_events.py b/ctrack/register/tests/test_events.py
index 1cff086..b8e4d8b 100644
--- a/ctrack/register/tests/test_events.py
+++ b/ctrack/register/tests/test_events.py
@@ -2,7 +2,7 @@ import datetime
import pytest
-from ctrack.register.models import MeetingEvent, EventType
+from ctrack.register.models import MeetingEvent, EventType, SingleDateTimeEvent
pytestmark = pytest.mark.django_db
@@ -39,6 +39,34 @@ def test_meeting_event(person, user):
assert person in e.participants.all()
assert e.user.name == uname
assert e.created_date.day == now.day
- assert e.created_date.hour == now.hour
assert e.modified_date.day == now.day
- assert e.modified_date.hour == now.hour
+
+
+def test_single_date_event(person, user):
+ """This tests for phone call, video call and email events"""
+ now = datetime.datetime.now()
+ phone_event = SingleDateTimeEvent.objects.create(
+ type_descriptor="Phone Call",
+ short_description="Important Phone Call",
+ datetime="2020-10-10T15:00",
+ comments="Comments on phone call",
+ # location is optional
+ user=user
+ )
+ phone_event.participants.add(person)
+ assert phone_event.type_descriptor == "Phone Call"
+ assert person in phone_event.participants.all()
+ assert phone_event.created_date.day == now.day
+
+ video_event = SingleDateTimeEvent.objects.create(
+ type_descriptor="Video Call",
+ short_description="Important Video Call",
+ datetime="2020-10-10T15:00",
+ comments="Comments on phone call",
+ # location is optional
+ user=user
+ )
+ video_event.participants.add(person)
+ assert video_event.type_descriptor == "Video Call"
+ assert person in video_event.participants.all()
+ assert video_event.created_date.day == now.day
diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py
index 0383fa3..9a0f541 100644
--- a/ctrack/register/tests/test_forms.py
+++ b/ctrack/register/tests/test_forms.py
@@ -5,6 +5,9 @@ from ..forms import AddMeetingForm
pytestmark = pytest.mark.django_db
+# TODO this test and the form code needs to be amended to save created_by and update_by
+# on the model
+
def test_init(user):
"""Here we test that we can pass in the user value from the view.
We don't want that to be field in the form.