Skip to content

Commit

Permalink
Make unexpected test failures more verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
agschwender committed Dec 4, 2016
1 parent 9110f23 commit 431c785
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pilbox/test/app_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def fetch_error(self, code, *args, **kwargs):

def fetch_success(self, *args, **kwargs):
response = self.fetch(*args, **kwargs)
self.assertEqual(response.code, 200)
msg = "failed to fetch %s, received %d with %s" \
% (args[0], response.code, response.body)
self.assertEqual(response.code, 200, msg)
return response

def get_image_resize_cases(self):
Expand Down Expand Up @@ -352,11 +354,11 @@ def test_valid_face(self):
def _assert_expected_case(self, case):
qs = urlencode(case["source_query_params"])
resp = self.fetch_success("/?%s" % qs)
msg = "/?%s does not match %s" \
% (qs, case["expected_path"])
if case["content_type"]:
self.assertEqual(resp.headers.get("Content-Type", None),
case["content_type"])
msg = "/?%s does not match %s" \
% (qs, case["expected_path"])
with open(case["expected_path"], "rb") as expected:
self.assertEqual(resp.buffer.read(), expected.read(), msg)

Expand Down

0 comments on commit 431c785

Please sign in to comment.