These are chat archives for django/django

Apr 2015
Eleni Lixourioti
Apr 01 2015 09:30
@moviedo this is not going to work for you because the exception happens before the assignment to self.response takes 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.
the test should basically be as simple as:
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_equal is 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
Eleni Lixourioti
Apr 01 2015 09:36
also, @moviedo regarding the “how do I show print statements” if you’re using Nose as your test runner you need to run your tests with -s for example ./manage test -s
Mauro Oviedo
Apr 01 2015 14:29
yeah, I’m working with some legacy code and some weird things happen within this test @Geekfish
I’m looking into this matter