[patch] Additions to TestCase for easy view testing
|Reported by:||Chris H. <chris@…>||Owned by:||adrian|
|Severity:||Keywords:||view client unit testing|
|Has patch:||yes||Needs documentation:||yes|
|Needs tests:||no||Patch needs improvement:||no|
At work we frequently have testing idioms likes this:
...do database stuff...
response = self.client.get('/some/url/')
check the response status code
check the response template
check the response content
check the response content_type
I'm attaching a patch, with tests, that adds a "check_view" method to TestCase that wraps up the common idiom of checking the status code, the template, the content and the content_type.
In my mind it's somewhat analogous to render_to_response -- it's a shortcut for a common idiom, and it doesn't prevent you from doing more complex/interesting testing with the other assertX methods.
Change History (4)
Changed 8 years ago by Chris H. <chris@…>
comment:1 Changed 8 years ago by russellm
- Needs documentation set
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 8 years ago by Simon G. <dev@…>
- Resolution set to wontfix
- Status changed from new to closed