Example #1
0
 def test_wrap_exception(self):
     """Wraps exceptions as ClientExceptions"""
     self.func.side_effect = TypeError
     self.assertRaises(http.ClientException, http.wrap(self.function))
Example #2
0
 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)
Example #3
0
 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))
Example #4
0
 def test_wrap_exception(self):
     '''Wraps exceptions as ClientExceptions'''
     self.func.side_effect = TypeError
     self.assertRaises(http.ClientException, http.wrap(self.function))
Example #5
0
 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))
Example #6
0
 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)
Example #7
0
 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))
Example #8
0
 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)