Merge "Replace unicode with six.text_type"
This commit is contained in:
commit
d124969fc2
@ -188,5 +188,5 @@ class TokenlessAuthHelper(object):
|
||||
raise exception.TokenlessAuthConfigError(
|
||||
issuer_attribute=CONF.tokenless_auth.issuer_attribute)
|
||||
|
||||
hashed_idp = hashlib.sha256(idp)
|
||||
hashed_idp = hashlib.sha256(idp.encode('utf-8'))
|
||||
return hashed_idp.hexdigest()
|
||||
|
@ -788,11 +788,11 @@ class TestCase(BaseTestCase):
|
||||
if isinstance(expected_regexp, six.string_types):
|
||||
expected_regexp = re.compile(expected_regexp)
|
||||
|
||||
if isinstance(exc_value.args[0], unicode):
|
||||
if not expected_regexp.search(unicode(exc_value)):
|
||||
if isinstance(exc_value.args[0], six.text_type):
|
||||
if not expected_regexp.search(six.text_type(exc_value)):
|
||||
raise self.failureException(
|
||||
'"%s" does not match "%s"' %
|
||||
(expected_regexp.pattern, unicode(exc_value)))
|
||||
(expected_regexp.pattern, six.text_type(exc_value)))
|
||||
else:
|
||||
if not expected_regexp.search(str(exc_value)):
|
||||
raise self.failureException(
|
||||
|
@ -40,7 +40,8 @@ class MiddlewareRequestTestBase(unit.TestCase):
|
||||
def _application(self):
|
||||
"""A base wsgi application that returns a simple response."""
|
||||
def app(environ, start_response):
|
||||
body = uuid.uuid4().hex
|
||||
# WSGI requires the body of the response to be six.binary_type
|
||||
body = uuid.uuid4().hex.encode('utf-8')
|
||||
resp_headers = [('Content-Type', 'text/html; charset=utf8'),
|
||||
('Content-Length', str(len(body)))]
|
||||
start_response('200 OK', resp_headers)
|
||||
@ -197,9 +198,10 @@ class AuthContextMiddlewareTest(test_backend_sql.SqlTests,
|
||||
self.config_fixture.config(group='tokenless_auth',
|
||||
trusted_issuer=[self.trusted_issuer])
|
||||
|
||||
# This idp_id is calculated based on
|
||||
# sha256(self.client_issuer)
|
||||
hashed_idp = hashlib.sha256(self.client_issuer)
|
||||
# client_issuer is encoded because you can't hash
|
||||
# unicode objects with hashlib.
|
||||
# This idp_id is calculated based on sha256(self.client_issuer)
|
||||
hashed_idp = hashlib.sha256(self.client_issuer.encode('utf-8'))
|
||||
self.idp_id = hashed_idp.hexdigest()
|
||||
self._load_sample_data()
|
||||
|
||||
|
1
tox.ini
1
tox.ini
@ -48,6 +48,7 @@ commands =
|
||||
keystone/tests/unit/test_exception.py \
|
||||
keystone/tests/unit/test_ipv6.py \
|
||||
keystone/tests/unit/test_kvs.py \
|
||||
keystone/tests/unit/test_middleware.py \
|
||||
keystone/tests/unit/test_no_admin_token_auth.py \
|
||||
keystone/tests/unit/test_policy.py \
|
||||
keystone/tests/unit/test_revoke.py \
|
||||
|
Loading…
x
Reference in New Issue
Block a user