djangogirls icon indicating copy to clipboard operation
djangogirls copied to clipboard

Add test coverage for `done` method of `OrganizeFormWizard` in `organize/views.py`

Open amakarudze opened this issue 3 years ago • 3 comments

We are always experiencing server errors in the event application process which require manual troubleshooting because the done method lacks test coverage. The code for submitting the form, which is in the done method of OrganizeFormWizard in organize/views.py, lacks coverage.

Tests need to be written for this method.

amakarudze avatar Sep 08 '21 19:09 amakarudze

I'm not entirely sure how you test done() of a WizardView class, because that method doesn't have a URL to test.

marksweb avatar Sep 11 '21 22:09 marksweb

Hey @marksweb, so the method is called by this url in organize/urls.py after all the form steps have been successful. It's using django-formtools. I was able to test most of the form steps using post requests but wasn't sure about hitting the database bit which is handled in the done() method. Maybe @carltongibson can help us with ideas for this test.

amakarudze avatar Sep 13 '21 00:09 amakarudze

I saw via sentry that done appears to be exposed in the urls as a step in the wizard. It expects a list of validated forms, so there may be a way of calling that, but I don't think it'll take the usual get/post requests from the client.

marksweb avatar Sep 14 '21 21:09 marksweb