lundi 28 septembre 2015

Django Testing: See traceback where wrong Response gets created

This pattern is from the django docs:

class SimpleTest(unittest.TestCase):
    def test_details(self):
        client = Client()
        response = client.get('/customer/details/')
        self.assertEqual(response.status_code, 200)

From: http://ift.tt/1YJPPxW

If the test fails, the error message does not help very much. For example the status_code is 404. I see 404 != 200.

The question is now: Where does the wrong HTTPResponse get created?

I would like to see the stacktrace of the interpreter where the wrong HTTPResponse object get created.

I read the docs for the assertions of django but found no matching method.

Aucun commentaire:

Enregistrer un commentaire