chol
/
eva
forked from tohe/eva
1
0
Fork 0

new test mac should have mac os

This commit is contained in:
Benni Bärmann 2021-09-14 11:58:22 +02:00
parent 4229928aae
commit bbd1e7ff6d
2 changed files with 9 additions and 4 deletions

View File

@ -1,9 +1,8 @@
from django.test import TestCase from django.test import TestCase
# import unittest
from django.test import Client from django.test import Client
from django.contrib.auth.models import User from django.contrib.auth.models import User
#from django.urls import reverse
from .forms import ITForm
class LoginTestCase(TestCase): class LoginTestCase(TestCase):
def setUp(self): def setUp(self):
@ -29,3 +28,9 @@ class NoLoginTestCase(TestCase):
self.assertEqual(response.status_code, 302) self.assertEqual(response.status_code, 302)
response2 = self.client.get(response.url) response2 = self.client.get(response.url)
self.assertContains( response2, 'Bitte via Wolke einloggen:', status_code=200) self.assertContains( response2, 'Bitte via Wolke einloggen:', status_code=200)
class ITFORMTestCase(TestCase):
def test_mac(self):
form = ITForm(data={"vendor": 'MAC', 'os': 'UBU'})
print (form.errors)
self.assertEqual(form.errors['os'], ['A MAC should have Mac OS installed'])

View File

@ -72,7 +72,7 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView):
data = super().get_all_cleaned_data() data = super().get_all_cleaned_data()
self.generate_email(data) self.generate_email(data)
print("delete CHOICE FROM DATA") # print("delete CHOICE FROM DATA")
if 'choice' in data: if 'choice' in data:
del data['choice'] del data['choice']
return data return data