Replace exception_to_str with oslo.utils function

The oslo.utils function has exception_to_unicode that can
replace glance util function exception_to_str.
So we don't to have this exception_to_str function in glance
anymore.

Change-Id: I332bc55558087920fdd6ae2d822bece5166f5ba6
This commit is contained in:
kairat_kushaev
2015-09-22 15:40:02 +03:00
parent 9f8163ec82
commit c6addc722c
6 changed files with 13 additions and 43 deletions
-18
View File
@@ -104,24 +104,6 @@ class TestUtils(testtools.TestCase):
''',
output_dict.getvalue())
def test_exception_to_str(self):
class FakeException(Exception):
def __str__(self):
raise UnicodeError()
ret = utils.exception_to_str(Exception('error message'))
self.assertEqual('error message', ret)
ret = utils.exception_to_str(Exception('\xa5 error message'))
if six.PY2:
self.assertEqual(' error message', ret)
else:
self.assertEqual('\xa5 error message', ret)
ret = utils.exception_to_str(FakeException('\xa5 error message'))
self.assertEqual("Caught '%(exception)s' exception." %
{'exception': 'FakeException'}, ret)
def test_schema_args_with_list_types(self):
# NOTE(flaper87): Regression for bug
# https://bugs.launchpad.net/python-glanceclient/+bug/1401032