From 78dcfc6446d2a367565f2fa58bb0da340c6928f8 Mon Sep 17 00:00:00 2001 From: Liang Chen Date: Tue, 9 Apr 2013 18:03:48 +0800 Subject: Fixed unicode username user creation error The code tries to construct a byte string object to test the length of the string field (The explicit construction of the string object is neccessary as sometime v can be other types, for example int). This will cause error if the string field (v) is a unicode object. Fixes bug #1166701 Change-Id: I73cee4da5c9f91ce135e7f81d88c979871f61767 --- tests/test_backend.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/test_backend.py') diff --git a/tests/test_backend.py b/tests/test_backend.py index fea52b8e..2a2b93aa 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -136,6 +136,15 @@ class IdentityTests(object): user_ref = self.identity_api._get_user(self.user_foo['id']) self.assertNotEqual(user_ref['password'], self.user_foo['password']) + def test_create_unicode_user_name(self): + unicode_name = u'name \u540d\u5b57' + user = {'id': uuid.uuid4().hex, + 'name': unicode_name, + 'domain_id': DEFAULT_DOMAIN_ID, + 'password': uuid.uuid4().hex} + ref = self.identity_api.create_user(user['id'], user) + self.assertEqual(unicode_name, ref['name']) + def test_get_project(self): tenant_ref = self.identity_api.get_project( tenant_id=self.tenant_bar['id']) -- cgit