def test_exception_class_names(self):
        # Create exception from class name
        error = FakeError('TooManyApplications', 400, 'foo', 'bar')
        exception = simple(error)
        self.assertEqual(exception.__class__.__name__, 'TooManyApplications')

        # Create exception from class name + 'Exception' as seen from the
        # live service today
        error = FakeError('TooManyApplicationsException', 400, 'foo', 'bar')
        exception = simple(error)
        self.assertEqual(exception.__class__.__name__, 'TooManyApplications')

        # Make sure message body is present
        self.assertEqual(exception.message, 'bar')
Exemple #2
0
    def test_exception_class_names(self):
        # Create exception from class name
        error = FakeError('TooManyApplications', 400, 'foo', 'bar')
        exception = simple(error)
        self.assertEqual(exception.__class__.__name__, 'TooManyApplications')

        # Create exception from class name + 'Exception' as seen from the
        # live service today
        error = FakeError('TooManyApplicationsException', 400, 'foo', 'bar')
        exception = simple(error)
        self.assertEqual(exception.__class__.__name__, 'TooManyApplications')

        # Make sure message body is present
        self.assertEqual(exception.message, 'bar')
Exemple #3
0
 def _wrapped_low_level_api(*args, **kwargs):
     try:
         response = func(*args, **kwargs)
     except BotoServerError as e:
         raise exception.simple(e)
     # Turn 'this_is_a_function_name' into 'ThisIsAFunctionNameResponse'.
     cls_name = ''.join([part.capitalize() for part in name.split('_')]) + 'Response'
     cls = getattr(boto.beanstalk.response, cls_name)
     return cls(response)
Exemple #4
0
 def _wrapped_low_level_api(*args, **kwargs):
     try:
         response = func(*args, **kwargs)
     except BotoServerError as e:
         raise exception.simple(e)
     # Turn 'this_is_a_function_name' into 'ThisIsAFunctionNameResponse'.
     cls_name = ''.join([part.capitalize()
                         for part in name.split('_')]) + 'Response'
     cls = getattr(boto.beanstalk.response, cls_name)
     return cls(response)
Exemple #5
0
 def _wrapped_low_level_api(*args, **kwargs):
     try:
         response = func(*args, **kwargs)
     except BotoServerError, e:
         raise exception.simple(e)
Exemple #6
0
 def _wrapped_low_level_api(*args, **kwargs):
     try:
         response = func(*args, **kwargs)
     except BotoServerError, e:
         raise exception.simple(e)