Skip to content

Django tutorial application with a few more tests.

Notifications You must be signed in to change notification settings

seporaitis/django-tutorial-tests

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Test Tutorial

badge

What is this?

This is the standard Django tutorial application with some extra tests.

Why is it here?

High level: provide examples of testing Django views, especially GET & POST requests, using Django test Client and Django RequestFactory.

The top-level difference between the two is that Client creates and runs the request starting at low-level HTTP, to middleware, to view, and returns the response object with the context, used to render template.

On the other hand, RequestFactory returns request object that can be then used to test view function as a black-box, with exactly known inputs, testing for specific outputs.

Although both have their purpose, request factory based tests are much faster than client, as can be observed by cloning this repository and running tox:

$ tox -- polls.tests.test_views_with_request_factory
... output ...
Ran 9 tests in 0.030s
$ tox -- polls.tests.test_views_with_client
... output ...
Ran 10 tests in 0.205s

Tests

More reading:

About

Django tutorial application with a few more tests.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published