Easy way to create mock Request objects for testing views
|Reported by:||simon||Owned by:||kkubasik|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The testing framework currently encourages hooking up a view function using a URLconf and then using the TestClient to run tests against the view.
It would be nice if there was an easy way to bypass URLconf entirely in testing and just create a mock object representing a GET / POST / etc request, then pass that directly to the view function.
And this snippet: http://www.djangosnippets.org/snippets/963/
Change History (11)
comment:1 follow-ups: ↓ 2 ↓ 3 Changed 5 years ago by zellyn
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset