Django provides a set of tools that come in handy when writing tests.
The test client is a Python class that acts as a dummy web browser, allowing you to test your views and interact with your Django-powered application programmatically. Some of the things you can do with the test client are:
Simulate
GET
andPOST
requests on a URL and observe the response-everything from low-level HTTP (result headers and status codes) to page content.See the chain of redirects (if any) and check the URL and status code at each step.
Test that a given request is rendered by a given Django template, with a template context that contains certain values.
Note that the test client is not intended to be a replacement for Selenium (for more information visit http://seleniumhq.org/) or other in-browser frameworks. Django's test client has a different focus. In short:
Use Django's test client to establish that the correct template is being rendered and that the template is passed the correct...