These are chat archives for django/django
self.responsetakes place. If an exception is being thrown then you need to catch it in your view and return a response with your error and a 400 status code. You shouldn’t have to wrap it in the test.
response = self.client.get(your_params) self.assertEqual(response.status_code, 405) response = self.client.put(your_params) self.assertEqual(response.status_code, 405)
assert_greater_equalis also not a good idea to use for such checks, because you want to test explicitly for “method not allowed”, otherwise if anything else goes wrong in your view you will accidentally allow the test to pass
./manage test -s