Added unit tests for djblets.auth.views.register
Review Request #10832 — Created Jan. 18, 2020 and submitted — Latest diff uploaded
Added unit tests for djblets.auth.views.register
Changes for latest revision
Change 1:
Created new templates for testing:base.htmlandregister.html.
This was to ensure that therenderfunction withinviews.pycould use a
template when running the test cases.Change 2:
Added url to view mapping fordjblets/auth/registerso that the url could be
used for http requests (get/post) to test responses. In previous revisions,RequestFactory
was used, and the functionregister()fromviews.pywas directly called within the test cases.Change 3:
Used Django's test client instead ofRequestFactory. This ensures that the register view actually
works as intended when its mapped url is called (rather than callingregister()directly.
- When register receives an http request that is not a POST request
- When register receives a POST request, but an invalid form is passed
- When register receives a POST request and a valid form is passed