summaryrefslogtreecommitdiff
path: root/ceilometerclient/tests/unit/test_exc.py
diff options
context:
space:
mode:
authorMehdi Abaakouk <sileht@redhat.com>2016-10-06 16:39:44 +0200
committerMehdi Abaakouk (sileht) <sileht@redhat.com>2016-10-11 09:10:10 +0000
commit9d9b477708fdce08db162a9bf3723cf7ee0df267 (patch)
treea01380657ffc5944fbeb3d3b94d205701df570ad /ceilometerclient/tests/unit/test_exc.py
parent05cbdbb6f5fb7c9d73e0b0d25f6a7f9dbdea7c92 (diff)
downloadpython-ceilometerclient-stable/newton.tar.gz
Set code and details on HTTPExceptionnewton-eol2.6.2stable/newton
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)
Diffstat (limited to 'ceilometerclient/tests/unit/test_exc.py')
-rw-r--r--ceilometerclient/tests/unit/test_exc.py7
1 files changed, 4 insertions, 3 deletions
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):