test for mail sending added

This commit is contained in:
Benni Bärmann 2021-09-20 13:40:26 +02:00
parent 61523c32b2
commit 8cd195a336
2 changed files with 8 additions and 4 deletions

2
TODO
View File

@ -1,5 +1,3 @@
* remove dot before "Nextcloud" at login page. * remove dot before "Nextcloud" at login page.
* test for mail sending
* firstname lastname in subject * firstname lastname in subject

View File

@ -3,6 +3,7 @@ from django.test import Client
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.conf import settings from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
from django.core import mail
from .forms import ITForm, WorkingForm, OfficeForm, DummyForm from .forms import ITForm, WorkingForm, OfficeForm, DummyForm
@ -40,7 +41,7 @@ class LoginTestCase(TestCase):
return response return response
def testWizzard(self): def testWizzard(self):
''' this test goes thru the whole process of the EvaFormView from start to end ''' ''' this test goes through the whole process of the EvaFormView from start to end '''
self.assertEqual(200, self.response.status_code) self.assertEqual(200, self.response.status_code)
@ -73,10 +74,15 @@ class LoginTestCase(TestCase):
'3-transponder': 'NORM' '3-transponder': 'NORM'
}, DummyForm) }, DummyForm)
repsone = self._postform({ response = self._postform({
'eva_form_view-current_step': '5', 'eva_form_view-current_step': '5',
}, DummyForm) }, DummyForm)
def test_mail(self):
self.testWizzard()
# print(mail.outbox)
self.assertGreater(len(mail.outbox), 2)
self.assertIn("Ara Seva", mail.outbox[0].subject)
class NoLoginTestCase(TestCase): class NoLoginTestCase(TestCase):
def setUp(self): def setUp(self):