aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-13 19:55:19 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-13 19:55:19 +0100
commit8f15ce5ce6061f4c8c6fbb4f50ceae55981a1e7e (patch)
treea1a082bd40db585d408f5cf2e6c53ca8dcff0e39 /ctrack
parent83b6a697e7b5a8f36ccd20e136f5500eb7b23ce1 (diff)
view test for missing required data
Diffstat (limited to 'ctrack')
-rw-r--r--ctrack/register/tests/test_views.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/ctrack/register/tests/test_views.py b/ctrack/register/tests/test_views.py
index 0b01047..21496b4 100644
--- a/ctrack/register/tests/test_views.py
+++ b/ctrack/register/tests/test_views.py
@@ -1,14 +1,17 @@
import pytest
from django.urls import reverse
+from django.test import TestCase
+
+test_case = TestCase("run")
from ctrack.register.views import SingleDateTimeEventCreate
pytestmark = pytest.mark.django_db
-class TestMeetingEventFormView:
+class TestSingleDateTimeEvent:
- def test_add_meeting_form(self, client):
+ def test_add_single_datetime_event_form(self, client):
url = reverse("register:event_create_simple_event")
response = client.get(url)
assert response.status_code == 200
@@ -27,6 +30,21 @@ class TestMeetingEventFormView:
# We're keeping the use field out of the form
assert "user" not in form.fields
+ def test_add_incorrect_form_data_single_datetime(self, client):
+ url = reverse("register:event_create_simple_event")
+ data = {
+ "type_descriptor": "Meeting X",
+ "short_description": "Test Short Description",
+ "datetime": "2010-10-10",
+ "comments": "Blah...",
+ "location": "The Moon"
+ }
+ response = client.post(url, data)
+ assert response.status_code == 200
+ html = response.content.decode("utf-8")
+ test_case.assertIn("Select a valid choice. Meeting X is not one of the available choices.", html)
+
+
def test_user_passed_as_kwarg(self, user, request_factory):
view = SingleDateTimeEventCreate()
request = request_factory.get("/register/event/create-simple-event/")
@@ -34,3 +52,9 @@ class TestMeetingEventFormView:
view.request = request
view.setup(request)
assert "user" in view.get_form_kwargs()
+
+class TestSingleDateCAFEventViews:
+
+ def test_initial_caf_recevied(self, client):
+ pass
+