Skip to content

Commit

Permalink
Fixed some bugs with formtools tests.
Browse files Browse the repository at this point in the history
Without these checks, it is possible for the tests to pass by virtue of
asserts never being reached for some reason (very possible in this case, due
to handling of security hashes).

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15198 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
spookylukey committed Jan 13, 2011
1 parent a6b9dbc commit cfcb591
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions django/contrib/formtools/tests/__init__.py
Expand Up @@ -356,11 +356,13 @@ def test_14498(self):
Regression test for ticket #14498. All previous steps' forms should be
validated.
"""
reached = [False]
that = self

class WizardWithProcessStep(WizardClass):
def process_step(self, request, form, step):
that.assertTrue(hasattr(form, 'cleaned_data'))
reached[0] = True

wizard = WizardWithProcessStep([WizardPageOneForm,
WizardPageTwoForm,
Expand All @@ -370,6 +372,7 @@ def process_step(self, request, form, step):
"hash_0": "7e9cea465f6a10a6fb47fcea65cb9a76350c9a5c",
"wizard_step": "1"}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])

def test_14576(self):
"""
Expand Down Expand Up @@ -400,6 +403,7 @@ def test_15075(self):
Regression test for ticket #15075. Allow modifying wizard's form_list
in process_step.
"""
reached = [False]
that = self

class WizardWithProcessStep(WizardClass):
Expand All @@ -408,6 +412,7 @@ def process_step(self, request, form, step):
self.form_list[1] = WizardPageTwoAlternativeForm
if step == 1:
that.assertTrue(isinstance(form, WizardPageTwoAlternativeForm))
reached[0] = True

wizard = WizardWithProcessStep([WizardPageOneForm,
WizardPageTwoForm,
Expand All @@ -417,3 +422,4 @@ def process_step(self, request, form, step):
"hash_0": "7e9cea465f6a10a6fb47fcea65cb9a76350c9a5c",
"wizard_step": "1"}
wizard(DummyRequest(POST=data))
self.assertTrue(reached[0])

0 comments on commit cfcb591

Please sign in to comment.