'Assert successful wizard response'

def assertWizardResponse(self, response, step=None):

    if (step is None):
        try:
            wizard = response.context_data['wizard']
            self.assertEqual(wizard['form'].errors, {})
        except (TypeError, KeyError):
            pass
        self.assertEqual(response.status_code, 302)
    else:
        self.assertIn('wizard', response.context_data)
        wizard = response.context_data['wizard']
        try:
            self.assertEqual(wizard['form'].errors, {})
        except AssertionError:
            self.assertIsNone(wizard['form'].errors)
        self.assertEqual(response.status_code, 200)
        self.assertIsNotNone(response.context_data['wizard'])
        self.assertEqual(wizard['steps'].current, step)
        response.render()
        self.assertContains(response, u'name="{0}-current_step"'.format(self.wizard_class_slug))
