Merge "Use the correct split_path in handle_request"

This commit is contained in:
Jenkins 2016-01-21 09:09:26 +00:00 committed by Gerrit Code Review
commit 3d7cac02b5
2 changed files with 14 additions and 1 deletions

View File

@ -631,7 +631,8 @@ class TempAuth(object):
req.start_time = time()
handler = None
try:
version, account, user, _junk = req.split_path(1, 4, True)
version, account, user, _junk = split_path(req.path_info,
1, 4, True)
except ValueError:
self.logger.increment('errors')
return HTTPNotFound(request=req)

View File

@ -517,6 +517,18 @@ class TestAuth(unittest.TestCase):
self.assertTrue(resp.headers['x-auth-token'].startswith('AUTH_'))
self.assertTrue(len(resp.headers['x-auth-token']) > 10)
def test_get_token_success_other_auth_prefix(self):
test_auth = auth.filter_factory({'user_ac_user': 'testing',
'auth_prefix': '/other/'})(FakeApp())
req = self._make_request(
'/other/v1.0',
headers={'X-Auth-User': 'ac:user', 'X-Auth-Key': 'testing'})
resp = req.get_response(test_auth)
self.assertEqual(resp.status_int, 200)
self.assertTrue(resp.headers['x-storage-url'].endswith('/v1/AUTH_ac'))
self.assertTrue(resp.headers['x-auth-token'].startswith('AUTH_'))
self.assertTrue(len(resp.headers['x-auth-token']) > 10)
def test_use_token_success(self):
# Example of how to simulate an authorized request
test_auth = auth.filter_factory({'user_acct_user': 'testing'})(