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:
Cyril Roelandt
2014-01-21 14:25:44 +01:00
parent 19d0396224
commit a663035230

View File

@@ -14,7 +14,6 @@
import sys
import mock
import six
from keystoneclient import exceptions
@@ -123,22 +122,7 @@ class PrintTestCase(test_utils.TestCase):
utils.print_list(objs, ['name'])
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):
name = u'\u540d\u5b57'
utils.print_dict({'name': name})
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})