Remove test_print_{dict,list}_unicode_without_encode
These tests do not really make sense: they expect the strutils.safe_encode() method to fail for some reason. Change-Id: I2ca07c06f86e4d83ae153601a0dab9a8f393f3e3
This commit is contained in:
@@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import mock
|
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
@@ -123,22 +122,7 @@ class PrintTestCase(test_utils.TestCase):
|
|||||||
utils.print_list(objs, ['name'])
|
utils.print_list(objs, ['name'])
|
||||||
self.assertIn(name, self.stdout.getvalue().decode('utf8'))
|
self.assertIn(name, self.stdout.getvalue().decode('utf8'))
|
||||||
|
|
||||||
@mock.patch('keystoneclient.openstack.common.strutils.safe_encode')
|
|
||||||
def test_print_list_unicode_without_encode(self, safe_encode_mock):
|
|
||||||
safe_encode_mock.side_effect = lambda x, *args, **kwargs: x
|
|
||||||
|
|
||||||
name = u'\u540d\u5b57'
|
|
||||||
objs = [FakeObject(name)]
|
|
||||||
self.assertRaises(UnicodeEncodeError, utils.print_list, objs, ['name'])
|
|
||||||
|
|
||||||
def test_print_dict_unicode(self):
|
def test_print_dict_unicode(self):
|
||||||
name = u'\u540d\u5b57'
|
name = u'\u540d\u5b57'
|
||||||
utils.print_dict({'name': name})
|
utils.print_dict({'name': name})
|
||||||
self.assertIn(name, self.stdout.getvalue().decode('utf8'))
|
self.assertIn(name, self.stdout.getvalue().decode('utf8'))
|
||||||
|
|
||||||
@mock.patch('keystoneclient.openstack.common.strutils.safe_encode')
|
|
||||||
def test_print_dict_unicode_without_encode(self, safe_encode_mock):
|
|
||||||
safe_encode_mock.side_effect = lambda x, *args, **kwargs: x
|
|
||||||
|
|
||||||
name = u'\u540d\u5b57'
|
|
||||||
self.assertRaises(UnicodeEncodeError, utils.print_dict, {'name': name})
|
|
||||||
|
Reference in New Issue
Block a user