summaryrefslogtreecommitdiffstats
path: root/tests/test_backend.py
diff options
context:
space:
mode:
authorLiang Chen <cbjchen@cn.ibm.com>2013-04-09 18:03:48 +0800
committerLiang Chen <cbjchen@cn.ibm.com>2013-04-13 15:30:53 +0800
commit78dcfc6446d2a367565f2fa58bb0da340c6928f8 (patch)
tree2108cecc3a9c1b2f4474c0e9daeefc030cd1ee97 /tests/test_backend.py
parentcbac77110ee1d7b9abc5a23f973dab27e8b32015 (diff)
downloadkeystone-78dcfc6446d2a367565f2fa58bb0da340c6928f8.tar.gz
keystone-78dcfc6446d2a367565f2fa58bb0da340c6928f8.tar.xz
keystone-78dcfc6446d2a367565f2fa58bb0da340c6928f8.zip
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
Diffstat (limited to 'tests/test_backend.py')
-rw-r--r--tests/test_backend.py9
1 files changed, 9 insertions, 0 deletions
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'])