forked from beba/foerderbarometer
add negative test for Literature form submission without terms_accepted
This commit is contained in:
parent
0d033e7e25
commit
ed2db04309
|
|
@ -131,3 +131,36 @@ 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.assertEqual(resp.status_code, 200)
|
||||
self.assertNotContains(resp, 'Deine Anfrage wurde gesendet.')
|
||||
self.assertRegex(
|
||||
resp.content.decode(),
|
||||
r'(Dieses Feld ist erforderlich|This field is required\.)'
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue