diff options
author | Drago Rosson <drago@rosson.me> | 2015-03-13 17:52:44 +0000 |
---|---|---|
committer | Drago Rosson <drago@rosson.me> | 2015-03-16 11:16:38 -0500 |
commit | a2124b8c7ef51620e0a8d55f276d9b3ad58cd867 (patch) | |
tree | b0a860d736b84896436d6d674b55a2a875c79c99 /heat/tests/test_fault_middleware.py | |
parent | 45be90bb22703645f782198ea4c585a4dd54ba72 (diff) | |
download | heat-a2124b8c7ef51620e0a8d55f276d9b3ad58cd867.tar.gz |
Separate message and traceback even if not a remote error
Faultwrap exposes tracebacks in error messages when Oslo.messaging
cannot add a _remote suffix to the exception generated by the Heat
engine.
Change-Id: Iaf91dafacce1abe94fb10aa2ba380cafb6fc4a84
closes-bug: #1432726
Diffstat (limited to 'heat/tests/test_fault_middleware.py')
-rw-r--r-- | heat/tests/test_fault_middleware.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/heat/tests/test_fault_middleware.py b/heat/tests/test_fault_middleware.py index 9be4fa7a4..c74d230d2 100644 --- a/heat/tests/test_fault_middleware.py +++ b/heat/tests/test_fault_middleware.py @@ -53,6 +53,21 @@ class FaultMiddlewareTest(common.HeatTestCase): 'title': 'Bad Request'} self.assertEqual(expected, msg) + def test_http_exception_with_traceback(self): + wrapper = fault.FaultWrapper(None) + newline_error = ErrorWithNewline( + 'Error with \n newline\nTraceback (most recent call last):\nFoo') + msg = wrapper._error(heat_exc.HTTPExceptionDisguise(newline_error)) + expected = {'code': 400, + 'error': {'message': 'Error with \n newline', + 'traceback': None, + 'type': 'ErrorWithNewline'}, + 'explanation': ('The server could not comply with the ' + 'request since it is either malformed ' + 'or otherwise incorrect.'), + 'title': 'Bad Request'} + self.assertEqual(expected, msg) + def test_openstack_exception_with_kwargs(self): wrapper = fault.FaultWrapper(None) msg = wrapper._error(heat_exc.StackNotFound(stack_name='a')) |