Ticket #20116: formwizard_formset_test.diff

File formwizard_formset_test.diff, 2.7 KB (added by foonicorn, 12 years ago)
  • django/contrib/formtools/tests/wizard/__init__.py

    diff --git a/django/contrib/formtools/tests/wizard/__init__.py b/django/contrib/formtools/tests/wizard/__init__.py
    index a2a9692..55c6e17 100644
    a b from django.contrib.formtools.tests.wizard.sessionstorage import TestSessionStor  
    1313from django.contrib.formtools.tests.wizard.wizardtests.tests import (
    1414    SessionWizardTests,
    1515    CookieWizardTests,
     16    FormsetWizardTests,
    1617    WizardTestKwargs,
    1718    WizardTestGenericViewInterface,
    1819    WizardFormKwargsOverrideTests,
  • django/contrib/formtools/tests/wizard/wizardtests/tests.py

    diff --git a/django/contrib/formtools/tests/wizard/wizardtests/tests.py b/django/contrib/formtools/tests/wizard/wizardtests/tests.py
    index 1ee5dbd..c152cbe 100644
    a b class WizardFormKwargsOverrideTests(TestCase):  
    404404        self.assertEqual(formset.initial_form_count(), 1)
    405405        self.assertEqual(['staff@example.com'],
    406406            list(formset.queryset.values_list('email', flat=True)))
     407
     408
     409class FormsetWizardTests(TestCase):
     410    urls = 'django.contrib.formtools.tests.wizard.wizardtests.urls'
     411    wizard_url = '/wiz_formset/'
     412    wizard_step_data = (
     413        {
     414            'form1-INITIAL_FORMS': '0',
     415            'form1-TOTAL_FORMS': '2',
     416            'form1-MAX_NUM_FORMS': '0',
     417            'form1-0-random_crap': 'blah blah',
     418            'form1-1-random_crap': 'blah blah',
     419            'cookie_contact_wizard-current_step': 'form1',
     420        },
     421        {
     422            'form2-random_crap': 'blah blah',
     423            'cookie_contact_wizard-current_step': 'form2',
     424        },
     425    )
     426
     427    def test_resend_data(self):
     428        response = self.client.post(self.wizard_url, self.wizard_step_data[0])
     429        self.assertEqual(response.status_code, 200)
     430
     431        response = self.client.post(self.wizard_url, self.wizard_step_data[1])
     432        self.assertEqual(response.status_code, 200)
     433
     434        response = self.client.post(self.wizard_url, self.wizard_step_data[1])
     435        self.assertEqual(response.status_code, 200)
  • django/contrib/formtools/tests/wizard/wizardtests/urls.py

    diff --git a/django/contrib/formtools/tests/wizard/wizardtests/urls.py b/django/contrib/formtools/tests/wizard/wizardtests/urls.py
    index dabce53..1d9b7d4 100644
    a b urlpatterns = patterns('',  
    1919          ('form3', Page3),
    2020          ('form4', Page4)],
    2121          template_name='other_wizard_form.html')),
     22    url(r'^wiz_formset/$', CookieContactWizard.as_view(
     23        [('form1', Page4),  # The test needs the formset as first form
     24         ('form2', Page3)])),
    2225)
Back to Top