def test_check_for_exceptions(self): status = [400, 422, 500] for s in status: resp = mock.Mock() # compat still uses status resp.status = s self.assertRaises(Exception, common.check_for_exceptions, resp, "body") # a no-exception case resp = mock.Mock() resp.status_code = 200 common.check_for_exceptions(resp, "body")