diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/register/tests/test_forms.py | 36 | ||||
-rw-r--r-- | ctrack/register/tests/test_models.py | 16 |
2 files changed, 26 insertions, 26 deletions
diff --git a/ctrack/register/tests/test_forms.py b/ctrack/register/tests/test_forms.py index fbc6479..b9c8b0b 100644 --- a/ctrack/register/tests/test_forms.py +++ b/ctrack/register/tests/test_forms.py @@ -1,7 +1,7 @@ import pytest from django.db import IntegrityError -from ..forms import CreateSimpleDateTimeEventForm, CAFSingleDateEventForm, CAFTwinDateEventForm +from ..forms import CreateSimpleDateTimeEventForm, CAFSingleDateEventForm, CAFTwinDateEventForm, CreateNoteEventForm pytestmark = pytest.mark.django_db @@ -83,23 +83,6 @@ def test_create_simple_datetime_event(user, org_with_people): assert form.is_valid() -def test_create_private_note(user, org_with_people): - 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, - "participants": org_with_people.get_people(), - "comments": "Test Comments not needed" - }, user=user, org_slug=None - ) - assert form.is_valid() - - def test_response_date_cannot_be_before_date(user, org_with_people): form = CreateSimpleDateTimeEventForm( { @@ -131,6 +114,23 @@ def test_meeting_blank_data(user, org_with_people): assert form.errors == {"datetime": ["This field is required."]} +# TODO - write the template and test the view for this and link from org detail page +def test_create_note(user, org_with_people): + """ + A note is related to an organisation rather than to persons in that organisation. + """ + form = CreateNoteEventForm( + { + "type_descriptor": "NOTE", + "short_description": "Test note", + "organisation": org_with_people, + "private": True, + "url": "https://www.bobbins.com/there-bos" + }, user=user + ) + assert form.is_valid() + + @pytest.mark.parametrize( "allowed_type", [ diff --git a/ctrack/register/tests/test_models.py b/ctrack/register/tests/test_models.py index e4f6a8d..aafd37f 100644 --- a/ctrack/register/tests/test_models.py +++ b/ctrack/register/tests/test_models.py @@ -7,7 +7,7 @@ from ctrack.register.models import ( EventType, SingleDateTimeEvent, CAFSingleDateEvent, - CAFTwinDateEvent, + CAFTwinDateEvent, NoteEvent, ) pytestmark = pytest.mark.django_db @@ -150,7 +150,6 @@ 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" @@ -220,15 +219,16 @@ def test_meeting_event(user, person): 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, +def test_note_event(user, org): + e = NoteEvent.objects.create( + type_descriptor="NOTE", 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,", + organisation=org, url="https://evidenceofcheese.com", private=True, user=user ) - assert e.type_descriptor == allowed_type + assert e.type_descriptor == "NOTE" + + |