From 4229928aaec6c0a7e9a982e22b801e62f64abbd7 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 14 Sep 2021 09:58:41 +0200 Subject: [PATCH] testmode warning --- TODO | 2 -- evapp/templates/evapp/employee_form.html | 3 +++ evapp/tests.py | 2 +- evapp/views.py | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index d05becc..4670e0b 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,4 @@ * enforce Mac OS if Mac is choosen? -* Maintainance-Anzeige im Debugmodus, damit niemand denkt, es würden mails verschickt. - * better error handling with mail sending. diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html index 49e0bd9..e95669d 100644 --- a/evapp/templates/evapp/employee_form.html +++ b/evapp/templates/evapp/employee_form.html @@ -29,6 +29,9 @@ + {% if TESTMODE %} +

WARNUNG! Test-MODUS aktiviert. Es werden keine Mails verschickt!

+ {% endif %}

E (V A) - Eintritt, (Veränderung, Austritt)

Du bist eingeloggt als {{ user.email }} diff --git a/evapp/tests.py b/evapp/tests.py index 57431b5..f71ae35 100644 --- a/evapp/tests.py +++ b/evapp/tests.py @@ -20,7 +20,7 @@ class LoginTestCase(TestCase): self.assertContains(self.response, "WARNUNG! Test-MODUS aktiviert. Es werden keine Mails verschickt!", status_code=200) -class SimpleTest(TestCase): +class NoLoginTestCase(TestCase): def setUp(self): self.client = Client() diff --git a/evapp/views.py b/evapp/views.py index 0ad6948..02d29a3 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -83,8 +83,10 @@ class EvaFormView(LoginRequiredMixin, CookieWizardView): #print('GETCONTEXT') context = super().get_context_data(form=form, **kwargs) + #testmode = settings.DEBUG or settings.MAILTEST context.update({'choice': self.choice, - 'choice_string': TYPE_CHOICES[self.choice]}) + 'choice_string': TYPE_CHOICES[self.choice], + 'TESTMODE': settings.DEBUG or settings.MAILTEST}) # deliver context for forms if we are in the last step if (self.steps.step1 == 5 or (self.choice != 'IN' and self.steps.step1 == 3)):