From b0bdf31a2c9ed3e23caa80335b45a01d242d1b0f Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Thu, 16 Sep 2021 14:26:02 +0200 Subject: [PATCH] more tests --- evapp/tests.py | 51 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/evapp/tests.py b/evapp/tests.py index d827ed3..3568ae2 100644 --- a/evapp/tests.py +++ b/evapp/tests.py @@ -3,7 +3,7 @@ from django.test import Client from django.contrib.auth.models import User from django.conf import settings -from .forms import ITForm +from .forms import ITForm, WorkingForm class LoginTestCase(TestCase): def setUp(self): @@ -17,9 +17,56 @@ class LoginTestCase(TestCase): def testDebugWarning(self): with self.settings(DEBUG=True): - self.response = self.client.get('/') + self.response = self.client.get('/') # we need to do it again with DEBUG = True self.assertContains(self.response, "WARNUNG! Test-MODUS aktiviert. Es werden keine Mails verschickt!", status_code=200) + def testWizzard(self): + ''' this test goes thru the whole process of the EvaFormView from start to end ''' + + self.assertEqual(200, self.response.status_code) + + response = self.client.post('/', { + 'eva_form_view-current_step': '0', + '0-firstname': 'Ara', + '0-lastname': 'Seva', + '0-department': 'CENT', + }) + #print(response.context) + + self.assertFalse(response.context['form'].is_bound) + print(response.context['wizard']['steps']) + self.assertEqual( + type(response.context['wizard']['form']), + WorkingForm + ) + + response = self.client.post('/', { + 'eva_form_view-current_step': '1', + '1-firstdate_employment': '2021-01-01', + '1-firstdate_presence': '2021-01-01', + '1-jobdescription_german': 'hau drauf', + '1-jobdescription_english': 'und schluss', + '1-works_in_gs': False + }, follow=True) + if 'form' in response.context: + self.assertFalse(response.context['form'].errors) + else: + raise "NO FORM FOUND" + + response = self.client.post('/', { + 'eva_form_view-current_step': '2', + '2-vendor': 'STANDARD', + '2-os': 'UBU', + '2-keyboard': 'DE', + '2-language': 'GER' + }, follow=True) + if 'form' in response.context: + self.assertFalse(response.context['form'].errors) + else: + raise "NO FORM FOUND" + + + class NoLoginTestCase(TestCase): def setUp(self):