I'm writing tests for my wizard using this excellent example from PyDoc.net.
One of the methods in my TestCase is not returning the correct step in the wizard:
class WizardTests(TestCase):
wizard_step_data = (
{
'step2-address': '123 Anywhere Ln.'
'wizard_wizard-current_step': 'step2'
},
)
def test_form_post_success(self):
response = self.client.post('/wizard/new/step2', self.wizard_step_data[0])
wizard = response.context['wizard']
self.assertEqual(response.status_code, 200)
self.assertEqual(wizard['steps'].current, 'step2')
When I run this, I get back:
Traceback (most recent call last):
File "/var/www/app/wizard/tests.py", line 71, in test_form_post_success
self.assertEqual(wizard['steps'].current, 'step2')
AssertionError: 'step1' != 'step2'
I am using a NamedUrlSessionWizardView, which is why my URL on the self.client.post
is /wizard/new/step2
, as opposed to just /wizard/
like the example above. Otherwise, I receive 404's, or 301's for /wizard/new
.
Do you have any ideas about what could be causing this?