'Regression test for ticket #11726.
Wizard should not raise Http404 when steps are added dynamically.'

def test_11726(self):

    reached = [False]
    that = self
    class WizardWithProcessStep(TestWizardClass, ):
        def process_step(self, request, form, step):
            if (step == 0):
                if (self.num_steps() < 2):
                    self.form_list.append(WizardPageTwoForm)
            if (step == 1):
                that.assertTrue(isinstance(form, WizardPageTwoForm))
                reached[0] = True
    wizard = WizardWithProcessStep([WizardPageOneForm])
    data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'1'}
    wizard(DummyRequest(POST=data))
    self.assertTrue(reached[0])
    data = {u'0-field': u'test', u'1-field': u'test2', u'hash_0': {2: u'cd13b1db3e8f55174bc5745a1b1a53408d4fd1ca', 3: u'9355d5dff22d49dbad58e46189982cec649f9f5b'}[pickle.HIGHEST_PROTOCOL], u'hash_1': {2: u'1e6f6315da42e62f33a30640ec7e007ad3fbf1a1', 3: u'c33142ef9d01b1beae238adf22c3c6c57328f51a'}[pickle.HIGHEST_PROTOCOL], u'wizard_step': u'2'}
    self.assertRaises(http.Http404, wizard, DummyRequest(POST=data))
