def test_wrap_exception(self): """Wraps exceptions as ClientExceptions""" self.func.side_effect = TypeError self.assertRaises(http.ClientException, http.wrap(self.function))
def test_wrap_basic(self): """Invokes a function with the same args and kwargs""" args = [1, 2, 3] kwargs = {"whiz": "bang"} http.wrap(self.function)(*args, **kwargs) self.func.assert_called_with(*args, **kwargs)
def test_wrap_non_200(self): """Raises a client exception""" self.result.status_code = 500 self.result.reason = "Internal Server Error" self.assertRaisesRegexp(http.ClientException, "Internal Server Error", http.wrap(self.function))
def test_wrap_exception(self): '''Wraps exceptions as ClientExceptions''' self.func.side_effect = TypeError self.assertRaises(http.ClientException, http.wrap(self.function))
def test_wrap_non_200(self): '''Raises a client exception''' self.result.status_code = 500 self.result.reason = 'Internal Server Error' self.assertRaisesRegexp(http.ClientException, 'Internal Server Error', http.wrap(self.function))
def test_wrap_basic(self): '''Invokes a function with the same args and kwargs''' args = [1, 2, 3] kwargs = {'whiz': 'bang'} http.wrap(self.function)(*args, **kwargs) self.func.assert_called_with(*args, **kwargs)