From 29028b60b46693c2ad9e786a61bd5e94bf6c7fa6 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 12 Oct 2020 20:33:04 +0100 Subject: first view test for events --- ctrack/register/tests/test_views.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 ctrack/register/tests/test_views.py (limited to 'ctrack/register/tests/test_views.py') diff --git a/ctrack/register/tests/test_views.py b/ctrack/register/tests/test_views.py new file mode 100644 index 0000000..51fceac --- /dev/null +++ b/ctrack/register/tests/test_views.py @@ -0,0 +1,18 @@ +import pytest + +from ctrack.register.views import SingleDateTimeEventCreate + +pytestmark = pytest.mark.django_db + + +class TestSingleDateFormView: + def test_single_datetime_event_form(self, user, request_factory): + view = SingleDateTimeEventCreate() + request = request_factory.get("/register/event/create-single-datetime/") + request.user = user + view.request = request + response = SingleDateTimeEventCreate.as_view()(request) + assert response.status_code == 200 + assert not response.context_data["form"].is_bound + for k in ["type_descriptor", "short_description", "datetime", "comments", "location"]: + assert k in response.context_data["form"].fields -- cgit v1.2.3