Created
April 28, 2015 10:01
-
-
Save cstrap/f737d2ac042e2ceadfc6 to your computer and use it in GitHub Desktop.
Testing FormWizard
https://groups.google.com/forum/#!msg/django-users/87iYPGK2GE8/MaWDVfBJsZ8J
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyForm(forms.Form): | |
| some_field = forms.CharField() | |
| class MyWizard(SessionWizardView): | |
| # ...do some stuff... | |
| # And a url like: | |
| url(r'^wizard/$', views.MyWizard.as_view([MyForm, MyOtherForm])) | |
| # Then your test needs to look like: | |
| class TestWizardView(TestCase): | |
| def test_form(self): | |
| data = {'my_wizard-current_step': '0', '0-some_field': 'whatever'} | |
| response = self.client.post('/wizard/', data=data) | |
| # your assertions here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment