diff --git a/input/tests/views.py b/input/tests/views.py index f32eeea..e6a8d01 100644 --- a/input/tests/views.py +++ b/input/tests/views.py @@ -32,7 +32,7 @@ class AnonymousViewTestCase(TestCase): return resolve_url('extern', type=info.path) - def helper_extern(self, choice, text, data): + def helper_extern_base(self, choice, text, data): url = self.helper_url(choice) response = request(self, url) @@ -41,7 +41,10 @@ class AnonymousViewTestCase(TestCase): data = self.get_step_data(choice, **data) - response = request(self, url, data=data) + return request(self, url, data=data) + + def helper_extern(self, choice, text, data): + response = self.helper_extern_base(choice, text, data) self.assertContains(response, 'Deine Anfrage wurde gesendet.') @@ -88,6 +91,20 @@ class AnonymousViewTestCase(TestCase): 'check': True, }) + def test_extern_lit_without_consent_fails(self): + response = self.helper_extern_base('LIT', 'Literatur verwenden', { + 'cost': 20, + 'info': 'Test', + 'source': 'Test', + 'notes': '', + 'selfbuy': 'TRUE', + 'selfbuy_data': 'NONE', + 'selfbuy_give_data': True, + 'check': False, + }) + + self.assertContains(response, 'Dieses Feld ist zwingend erforderlich.') + def test_extern_bib(self): self.helper_extern('BIB', 'Bibliotheksausweis', { 'cost': 20, @@ -138,32 +155,3 @@ class AuthenticatedViewTestCase(TestCase): def test_deny_error(self): self.helper_auth_deny_error('deny') - - -class TermsConsentViewTests(AnonymousViewTestCase): - - def test_extern_lit(self): - """ - Negative case: Literature form without terms_accepted must not succeed - and should display a required field error. - """ - # Step 1 - resp = request(self, 'extern', data=self.get_first_step_data('LIT')) - self.assertContains(resp, 'Literatur verwenden') - - # Step 2: submit without terms_accepted - payload = self.get_step_data(1, { - 'cost': 20, - 'info': 'Test', - 'source': 'Test', - 'notes': '', - 'selfbuy': 'TRUE', - 'selfbuy_data': 'NONE', - 'selfbuy_give_data': 'on', # checkbox checked - # terms_accepted intentionally omitted - }) - resp = request(self, 'extern', data=payload) - - # Expect to remain on step 2 with required field error - self.assertNotContains(resp, 'Deine Anfrage wurde gesendet.') - self.assertContains(resp, 'Dieses Feld ist zwingend erforderlich.')