summaryrefslogtreecommitdiff
path: root/heat/tests/test_fault_middleware.py
diff options
context:
space:
mode:
authorDrago Rosson <drago@rosson.me>2015-03-13 17:52:44 +0000
committerDrago Rosson <drago@rosson.me>2015-03-16 11:16:38 -0500
commita2124b8c7ef51620e0a8d55f276d9b3ad58cd867 (patch)
treeb0a860d736b84896436d6d674b55a2a875c79c99 /heat/tests/test_fault_middleware.py
parent45be90bb22703645f782198ea4c585a4dd54ba72 (diff)
downloadheat-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.py15
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'))