test_web: improve shouldFail2() error reporting

This commit is contained in:
Brian Warner 2012-05-09 14:18:37 -07:00
parent a92385b54b
commit 81c30b1cd1

@ -479,9 +479,14 @@ class WebMixin(object):
if isinstance(res, failure.Failure):
res.trap(expected_failure)
if substring:
self.failUnlessIn(substring, str(res), which)
self.failUnlessIn(substring, str(res),
"'%s' not in '%s' for test '%s'" % \
(substring, str(res), which))
if response_substring:
self.failUnlessIn(response_substring, res.value.response, which)
self.failUnlessIn(response_substring, res.value.response,
"'%s' not in '%s' for test '%s'" % \
(response_substring, res.value.response,
which))
else:
self.fail("%s was supposed to raise %s, not get '%s'" %
(which, expected_failure, res))