Added unit tests for djblets.auth.views.register

Review Request #10832 — Created Jan. 18, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-1.0.x
617418a...

Reviewers

Added unit tests for djblets.auth.views.register

Changes for latest revision
Change 1:
Created new templates for testing: base.html and register.html.
This was to ensure that the render function within views.py could use a
template when running the test cases.

Change 2:
Added url to view mapping for djblets/auth/register so that the url could be
used for http requests (get/post) to test responses. In previous revisions, RequestFactory
was used, and the function register() from views.py was directly called within the test cases.

Change 3:
Used Django's test client instead of RequestFactory. This ensures that the register view actually
works as intended when its mapped url is called (rather than calling register() 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
    Loading...