Merge "Removed/fixed unused variable references"
This commit is contained in:
commit
15635261a4
@ -354,19 +354,16 @@ class DiabloAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
|||||||
def test_valid_diablo_response(self):
|
def test_valid_diablo_response(self):
|
||||||
req = webob.Request.blank('/')
|
req = webob.Request.blank('/')
|
||||||
req.headers['X-Auth-Token'] = VALID_DIABLO_TOKEN
|
req.headers['X-Auth-Token'] = VALID_DIABLO_TOKEN
|
||||||
body = self.middleware(req.environ, self.start_fake_response)
|
self.middleware(req.environ, self.start_fake_response)
|
||||||
self.assertEqual(self.response_status, 200)
|
self.assertEqual(self.response_status, 200)
|
||||||
|
|
||||||
|
|
||||||
class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
||||||
|
|
||||||
def assert_valid_request_200(self, token):
|
def assert_valid_request_200(self, token):
|
||||||
|
|
||||||
req = webob.Request.blank('/')
|
req = webob.Request.blank('/')
|
||||||
req.headers['X-Auth-Token'] = token
|
req.headers['X-Auth-Token'] = token
|
||||||
body = self.middleware(req.environ, self.start_fake_response)
|
body = self.middleware(req.environ, self.start_fake_response)
|
||||||
self.assertEqual(self.response_status, 200)
|
self.assertEqual(self.response_status, 200)
|
||||||
catalog = req.headers.get('X-Service-Catalog')
|
|
||||||
self.assertTrue(req.headers.get('X-Service-Catalog'))
|
self.assertTrue(req.headers.get('X-Service-Catalog'))
|
||||||
self.assertEqual(body, ['SUCCESS'])
|
self.assertEqual(body, ['SUCCESS'])
|
||||||
|
|
||||||
@ -567,8 +564,3 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
|
|||||||
self.assertEqual(self.response_status, 200)
|
self.assertEqual(self.response_status, 200)
|
||||||
self.assertFalse(req.headers.get('X-Service-Catalog'))
|
self.assertFalse(req.headers.get('X-Service-Catalog'))
|
||||||
self.assertEqual(body, ['SUCCESS'])
|
self.assertEqual(body, ['SUCCESS'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import unittest
|
|
||||||
unittest.main()
|
|
||||||
|
@ -667,6 +667,14 @@ class TokenTests(object):
|
|||||||
data = {'id_hash': token_id, 'id': token_id, 'a': 'b'}
|
data = {'id_hash': token_id, 'id': token_id, 'a': 'b'}
|
||||||
data_ref = self.token_api.create_token(token_id, data)
|
data_ref = self.token_api.create_token(token_id, data)
|
||||||
self.token_api.delete_token(token_id)
|
self.token_api.delete_token(token_id)
|
||||||
|
self.assertRaises(
|
||||||
|
exception.TokenNotFound,
|
||||||
|
self.token_api.get_token,
|
||||||
|
data_ref['id'])
|
||||||
|
self.assertRaises(
|
||||||
|
exception.TokenNotFound,
|
||||||
|
self.token_api.delete_token,
|
||||||
|
data_ref['id'])
|
||||||
return token_id
|
return token_id
|
||||||
|
|
||||||
def test_list_revoked_tokens_returns_empty_list(self):
|
def test_list_revoked_tokens_returns_empty_list(self):
|
||||||
|
@ -626,7 +626,7 @@ class JsonTestCase(RestfulTestCase, CoreApiTests):
|
|||||||
self.assertValidErrorResponse(r)
|
self.assertValidErrorResponse(r)
|
||||||
|
|
||||||
def test_fetch_revocation_list_nonadmin_fails(self):
|
def test_fetch_revocation_list_nonadmin_fails(self):
|
||||||
r = self.admin_request(
|
self.admin_request(
|
||||||
method='GET',
|
method='GET',
|
||||||
path='/v2.0/tokens/revoked',
|
path='/v2.0/tokens/revoked',
|
||||||
expected_status=401)
|
expected_status=401)
|
||||||
|
@ -46,13 +46,13 @@ class UrlMiddlewareTest(test.TestCase):
|
|||||||
"""Tests /v2.0/tokens and /v2.0/tokens/ normalized URLs match."""
|
"""Tests /v2.0/tokens and /v2.0/tokens/ normalized URLs match."""
|
||||||
req1 = webob.Request.blank('/v2.0/tokens')
|
req1 = webob.Request.blank('/v2.0/tokens')
|
||||||
req2 = webob.Request.blank('/v2.0/tokens/')
|
req2 = webob.Request.blank('/v2.0/tokens/')
|
||||||
_ = self.middleware(req1.environ, self.start_fake_response)
|
self.middleware(req1.environ, self.start_fake_response)
|
||||||
_ = self.middleware(req2.environ, self.start_fake_response)
|
self.middleware(req2.environ, self.start_fake_response)
|
||||||
self.assertEqual(req1.path_url, req2.path_url)
|
self.assertEqual(req1.path_url, req2.path_url)
|
||||||
self.assertEqual(req1.path_url, 'http://localhost/v2.0/tokens')
|
self.assertEqual(req1.path_url, 'http://localhost/v2.0/tokens')
|
||||||
|
|
||||||
def test_rewrite_empty_path(self):
|
def test_rewrite_empty_path(self):
|
||||||
"""Tests empty path is rewritten to root."""
|
"""Tests empty path is rewritten to root."""
|
||||||
req = webob.Request.blank('')
|
req = webob.Request.blank('')
|
||||||
_ = self.middleware(req.environ, self.start_fake_response)
|
self.middleware(req.environ, self.start_fake_response)
|
||||||
self.assertEqual(req.path_url, 'http://localhost/')
|
self.assertEqual(req.path_url, 'http://localhost/')
|
||||||
|
Loading…
Reference in New Issue
Block a user