From 9d9b477708fdce08db162a9bf3723cf7ee0df267 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Thu, 6 Oct 2016 16:39:44 +0200 Subject: Set code and details on HTTPException Even the HTTPException is unknown for ceilometer we should set the code and print it with the details. Closes-bug: #1626404 Change-Id: Ib244d8822f7a1ebc1b8ec1b95d13b20bbb69ece0 (cherry picked from commit b8a78396b273c23ba7a633d98365a5dfc969b1f2) --- ceilometerclient/tests/unit/test_exc.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'ceilometerclient/tests') diff --git a/ceilometerclient/tests/unit/test_exc.py b/ceilometerclient/tests/unit/test_exc.py index b0fd1b1..e67cfc8 100644 --- a/ceilometerclient/tests/unit/test_exc.py +++ b/ceilometerclient/tests/unit/test_exc.py @@ -41,7 +41,7 @@ class HTTPExceptionsTest(utils.BaseTestCase): def test_str_no_json(self): for k, v in HTTPEXCEPTIONS.items(): exception = v(details="foo") - ret_str = k + " (HTTP " + str(exception.code) + ")" + ret_str = k + " (HTTP " + str(exception.code) + ") foo" self.assertEqual(ret_str, str(exception)) def test_str_no_error_message(self): @@ -54,13 +54,14 @@ class HTTPExceptionsTest(utils.BaseTestCase): for k, v in HTTPEXCEPTIONS.items(): exception = v( details=json.dumps({"error_message": {"foo": "bar"}})) - ret_str = k + " (HTTP " + str(exception.code) + ")" + ret_str = (k + " (HTTP " + str(exception.code) + ") " + + str({u'foo': u'bar'})) self.assertEqual(ret_str, str(exception)) def test_str_error_message_unknown_format(self): for k, v in HTTPEXCEPTIONS.items(): exception = v(details=json.dumps({"error_message": "oops"})) - ret_str = k + " (HTTP " + str(exception.code) + ")" + ret_str = k + " (HTTP " + str(exception.code) + ") oops" self.assertEqual(ret_str, str(exception)) def test_str_faultstring(self): -- cgit v1.2.1