Skip to content

Commit

Permalink
auth tests should not require admin token
Browse files Browse the repository at this point in the history
Currently all the v3 auth tests are calling self.post(), which
eventually going through keystone.tests.test_v3.v3_request().
The v3_request method always requires an auth token by default.
But since V3 auth token API is an unprotected API, there's no need
for an auth token in order to make the request.

Change-Id: If65305346c0e5e114fd03e4ba089aa2e3694a8b2
Closes-bug: #1317261
  • Loading branch information
wanghonghw committed Jul 21, 2014
1 parent f9b4002 commit b039026
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 239 deletions.
14 changes: 7 additions & 7 deletions keystone/tests/test_v3.py
Expand Up @@ -423,21 +423,21 @@ def get_scoped_token(self):
def get_requested_token(self, auth):
"""Request the specific token we want."""

r = self.admin_request(
method='POST',
path='/v3/auth/tokens',
body=auth)
r = self.v3_authenticate_token(auth)
return r.headers.get('X-Subject-Token')

def v3_authenticate_token(self, auth, expected_status=201):
return self.admin_request(method='POST',
path='/v3/auth/tokens',
body=auth,
expected_status=expected_status)

def v3_noauth_request(self, path, **kwargs):
# request does not require auth token header
path = '/v3' + path
return self.admin_request(path=path, **kwargs)

def v3_request(self, path, **kwargs):
# TODO(gyee): need to fix all the v3 auth tests. They should not
# require the token header.

# check to see if caller requires token for the API call.
if kwargs.pop('noauth', None):
return self.v3_noauth_request(path, **kwargs)
Expand Down

0 comments on commit b039026

Please sign in to comment.