From 66c4fd3c42dd30f731fdd1d1fca2e672fd9fcc69 Mon Sep 17 00:00:00 2001 From: Christian Berendt Date: Mon, 26 May 2014 11:12:11 +0200 Subject: [PATCH] replaced unicode() with six.text_type() According to https://wiki.openstack.org/wiki/Python3 unicode() should be replaced with six.text_type(). Change-Id: I7e6119d66b7ad51e4a8ee7b3d8ce4188e321a08b --- keystone/tests/test_v3_controller.py | 3 ++- keystone/tests/test_v3_os_revoke.py | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/keystone/tests/test_v3_controller.py b/keystone/tests/test_v3_controller.py index e721adb0b..043a40f26 100644 --- a/keystone/tests/test_v3_controller.py +++ b/keystone/tests/test_v3_controller.py @@ -14,6 +14,7 @@ import uuid +import six from testtools import matchers from keystone.common import controller @@ -45,7 +46,7 @@ class V3ControllerTestCase(tests.TestCase): ex = self.assertRaises(exception.ImmutableAttributeError, self.api.check_immutable_params, ref) - ex_msg = unicode(ex) + ex_msg = six.text_type(ex) self.assertThat(ex_msg, matchers.Contains(self.api.__class__.__name__)) for key in ref.keys(): self.assertThat(ex_msg, matchers.Contains(key)) diff --git a/keystone/tests/test_v3_os_revoke.py b/keystone/tests/test_v3_os_revoke.py index 155b433b8..f76d13782 100644 --- a/keystone/tests/test_v3_os_revoke.py +++ b/keystone/tests/test_v3_os_revoke.py @@ -13,6 +13,8 @@ import datetime import uuid +import six + from keystone.common import dependency from keystone.contrib.revoke import model from keystone.openstack.common import timeutils @@ -61,9 +63,9 @@ class OSRevokeTests(test_v3.RestfulTestCase): user_id = uuid.uuid4().hex expires_at = token.default_expire_time() sample = self._blank_event() - sample['user_id'] = unicode(user_id) - sample['expires_at'] = unicode(timeutils.isotime(expires_at, - subsecond=True)) + sample['user_id'] = six.text_type(user_id) + sample['expires_at'] = six.text_type(timeutils.isotime(expires_at, + subsecond=True)) before_time = timeutils.utcnow() self.revoke_api.revoke_by_expiration(user_id, expires_at) resp = self.get('/OS-REVOKE/events') @@ -74,7 +76,7 @@ class OSRevokeTests(test_v3.RestfulTestCase): def test_disabled_project_in_list(self): project_id = uuid.uuid4().hex sample = dict() - sample['project_id'] = unicode(project_id) + sample['project_id'] = six.text_type(project_id) before_time = timeutils.utcnow() self.revoke_api.revoke( model.RevokeEvent(project_id=project_id)) @@ -87,7 +89,7 @@ class OSRevokeTests(test_v3.RestfulTestCase): def test_disabled_domain_in_list(self): domain_id = uuid.uuid4().hex sample = dict() - sample['domain_id'] = unicode(domain_id) + sample['domain_id'] = six.text_type(domain_id) before_time = timeutils.utcnow() self.revoke_api.revoke( model.RevokeEvent(domain_id=domain_id)) @@ -108,7 +110,7 @@ class OSRevokeTests(test_v3.RestfulTestCase): def test_since_future_time_no_events(self): domain_id = uuid.uuid4().hex sample = dict() - sample['domain_id'] = unicode(domain_id) + sample['domain_id'] = six.text_type(domain_id) self.revoke_api.revoke( model.RevokeEvent(domain_id=domain_id))