Fix the python3.4 TypeError

Python3.4 throwing TypeError and in this patch it
is fixed

Co-Authored-By: David Purcell <david.purcell@att.com>
Change-Id: I5cbc54142ba2fd1885879c2e401ba84095becc1a
Closes-Bug: #1625219
This commit is contained in:
venkatamahesh 2016-09-20 11:10:59 +05:30 committed by Kirill Zaitsev
parent 233942c968
commit 403bb2721a
2 changed files with 1 additions and 9 deletions

View File

@ -91,7 +91,7 @@ class ExternalContextMiddleware(wsgi.Middleware):
try:
credentials = base64.b64decode(
req.headers['Authorization'].split(' ')[1])
user, password = credentials.split(':', 2)
user, password = credentials.decode('utf-8').split(':', 2)
req.headers['X-Auth-Token'] = self.get_keystone_token(user,
password)
req.endpoints = self.get_endpoints()

View File

@ -14,8 +14,6 @@
# under the License.
import mock
import sys
import unittest
import webob
from keystoneauth1 import exceptions
@ -28,8 +26,6 @@ from oslo_serialization import base64
class MiddlewareExtContextTest(base.MuranoTestCase):
@unittest.skipIf(sys.version_info > (2, 7),
'Skip until bug/1625219 resolved')
def test_middleware_ext_context_default(self):
middleware = ext_context.ExternalContextMiddleware(None)
middleware.get_keystone_token = mock.MagicMock(return_value="token?")
@ -42,8 +38,6 @@ class MiddlewareExtContextTest(base.MuranoTestCase):
middleware.process_request(request)
self.assertEqual(request.headers.get('X-Auth-Token'), "token?")
@unittest.skipIf(sys.version_info > (2, 7),
'Skip until bug/1625219 resolved')
def test_middleware_ext_context_except_key_error(self):
middleware = ext_context.ExternalContextMiddleware(None)
middleware.get_keystone_token = mock.MagicMock(
@ -58,8 +52,6 @@ class MiddlewareExtContextTest(base.MuranoTestCase):
self.assertRaises(webob.exc.HTTPUnauthorized,
middleware.process_request, request)
@unittest.skipIf(sys.version_info > (2, 7),
'Skip until bug/1625219 resolved')
def test_middleware_ext_context_except_unauthorized(self):
middleware = ext_context.ExternalContextMiddleware(None)
middleware.get_keystone_token = mock.MagicMock(