Ensure to_dict() supports unicode
When we compose a string for user_identity, we should ensure that we don't break for non-ascii strings in user name or tenant name or domain names. Change-Id: Id457ebe415f78c435fc8ece810f0a1b20964dabf Closes-Bug: #1507937
This commit is contained in:
parent
187d574063
commit
c63a359094
|
@ -48,7 +48,7 @@ class RequestContext(object):
|
|||
accesses the system, as well as additional request information.
|
||||
"""
|
||||
|
||||
user_idt_format = '{user} {tenant} {domain} {user_domain} {p_domain}'
|
||||
user_idt_format = u'{user} {tenant} {domain} {user_domain} {p_domain}'
|
||||
|
||||
def __init__(self, auth_token=None, user=None, tenant=None, domain=None,
|
||||
user_domain=None, project_domain=None, is_admin=False,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# Copyright 2011 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
|
@ -177,7 +178,8 @@ class ContextTest(test_base.BaseTestCase):
|
|||
|
||||
def test_values(self):
|
||||
auth_token = "token1"
|
||||
user = "user1"
|
||||
# test unicode support
|
||||
user = u"John Gāo"
|
||||
tenant = "tenant1"
|
||||
domain = "domain1"
|
||||
user_domain = "user_domain1"
|
||||
|
|
Loading…
Reference in New Issue