From 61523c32b23cb6c4744110411b5b7df7f41839ea Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 20 Sep 2021 12:15:13 +0200 Subject: [PATCH] walkthrough test completed --- TODO | 2 -- evapp/tests.py | 31 ++++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 1c1ef69..9a7b97b 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ * remove dot before "Nextcloud" at login page. -* test for complete run with all forms - * test for mail sending * firstname lastname in subject diff --git a/evapp/tests.py b/evapp/tests.py index 5b3d049..194897e 100644 --- a/evapp/tests.py +++ b/evapp/tests.py @@ -2,8 +2,9 @@ from django.test import TestCase from django.test import Client from django.contrib.auth.models import User from django.conf import settings +from django.http import HttpResponse -from .forms import ITForm, WorkingForm, OfficeForm +from .forms import ITForm, WorkingForm, OfficeForm, DummyForm class LoginTestCase(TestCase): def setUp(self): @@ -25,15 +26,18 @@ class LoginTestCase(TestCase): def _postform(self, data, expected_form): response = self.client.post('/', data, follow=True) - if 'form' in response.context: - self.assertFalse(response.context['form'].errors) - else: - raise "NO FORM FOUND" + # print(type(response)) + self.assertEqual(200, self.response.status_code) + if not type(response) == HttpResponse: + if 'form' in response.context: + self.assertFalse(response.context['form'].errors) + else: + raise "NO FORM FOUND" + self.assertEqual( + type(response.context['wizard']['form']), + expected_form + ) return response - self.assertEqual( - type(response.context['wizard']['form']), - expected_form - ) def testWizzard(self): ''' this test goes thru the whole process of the EvaFormView from start to end ''' @@ -64,6 +68,15 @@ class LoginTestCase(TestCase): '2-language': 'GER' }, OfficeForm) + response = self._postform({ + 'eva_form_view-current_step': '3', + '3-transponder': 'NORM' + }, DummyForm) + + repsone = self._postform({ + 'eva_form_view-current_step': '5', + }, DummyForm) + class NoLoginTestCase(TestCase): def setUp(self):