测试Django向导视图

测试Django向导视图,django,python-3.x,django-testing,django-formwizard,django-formtools,Django,Python 3.x,Django Testing,Django Formwizard,Django Formtools,我正在使用中的这个优秀示例为我的向导编写测试 TestCase中的一个方法未返回向导中的正确步骤: class WizardTests(TestCase): wizard_step_data = ( { 'step2-address': '123 Anywhere Ln.' 'wizard_wizard-current_step': 'step2' }, ) def test_form_po

我正在使用中的这个优秀示例为我的向导编写测试

TestCase中的一个方法未返回向导中的正确步骤:

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')
当我运行此命令时,我会返回:

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'
我使用的是NamedUrlSessionWizardView,这就是为什么我在
self.client.post
上的URL是
/wizard/new/step2
,而不是像上面的示例那样的
/wizard/
。否则,我会收到404或301的
/wizard/new

你知道是什么导致了这一切吗