Problem: When using the test client, it's simple to check for a 200 response code, but not quite as simple to quickly determine, why a 500 was encountered, in the case of a test failure.
Proposed Solution: A new test method which expects a status code of X, and when a 500 is encountered instead, the error that caused the 500 is output for ease of debugging, such as (one idea for the interface): class FooTestCase(TestCase): def test_foo(self): response = self.client.get('/foo/2/') self.assertStatusCode(foo_response, 302) # Default could be 200, in practice When an error response is encountered by the above test could be, roughly: F ====================================================================== FAIL: test_foo (example.foo.tests.FooTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/example/foo/tests.py", line 8, in test_foo self.assertStatusCode(foo_response, 302) AssertionError: 302 != 500 Client response error: [ERROR THAT CAUSED 500 OR FULL TRACEBACK GOES HERE] ^^ That is, by no means, *the* way to output the information or *the* best name for the test method, just my way of conveying the idea. I don't know how best to achieve this, aside from the obvious, non- magic version, which would be some regex to parse the response content. I haven't even looked into the matter, from a low-level standpoint, and won't unless there is a consensus on what this should look like, as well as a mutual desire to add this new method. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.