step two for test_bib added, but not working

This commit is contained in:
Benni Baermann 2021-10-11 15:50:16 +02:00
parent 0da3b2a4b5
commit 2bf0ff1504
2 changed files with 22 additions and 3 deletions

View file

@ -177,7 +177,7 @@ class Library(Grant):
type = models.CharField( type = models.CharField(
max_length=4, max_length=4,
choices=TYPE_CHOICES.items(), #attention: actually only BIB, ELIT, SOFT should be used here choices=TYPE_CHOICES.items(), #attention: actually only BIB, ELIT, SOFT should be used here
default='LIB', default='BIB',
) )
library = models.CharField(max_length=200) library = models.CharField(max_length=200)
duration = models.CharField(max_length=100, verbose_name="Dauer") duration = models.CharField(max_length=100, verbose_name="Dauer")

View file

@ -40,10 +40,17 @@ class TestWithoutLogin(TestCase):
self.assertEqual(200, self.response.status_code) self.assertEqual(200, self.response.status_code)
if not type(response) == HttpResponse: if not type(response) == HttpResponse:
if 'form' in response.context: if 'form' in response.context:
print('CONTENT')
print(response.content)
print('ITEMS')
print(response.items())
self.assertFalse(response.context['form'].errors) self.assertFalse(response.context['form'].errors)
else: else:
print(response.context) if expected_form:
raise BaseException("NO FORM FOUND") print(response.context)
raise BaseException("NO FORM FOUND")
else:
self.assertContains(response,"Deine Anfrage wurde gesendet.")
self.assertEqual( self.assertEqual(
type(response.context['wizard']['form']), type(response.context['wizard']['form']),
expected_form expected_form
@ -55,6 +62,8 @@ class TestWithoutLogin(TestCase):
self.response = self.client.get('/') self.response = self.client.get('/')
self.assertEqual(200, self.response.status_code) self.assertEqual(200, self.response.status_code)
print("\n\nEINS EINS\n\n")
response = self._postform({ response = self._postform({
'extern_view-current_step': '0', 'extern_view-current_step': '0',
'0-realname': 'vladimir reiherzehe', '0-realname': 'vladimir reiherzehe',
@ -64,6 +73,16 @@ class TestWithoutLogin(TestCase):
'0-check': True '0-check': True
}, LibraryForm) }, LibraryForm)
print("\n\nZWEI ZWEI\n\n")
response = self._postform({
'extern_view-current_step': '1',
'1-cost': 'teuroooo!',
'1-duration': 'looooong',
'1-library': 'of congress',
}, None)
class TestWithLogin(TestCase): class TestWithLogin(TestCase):