Merge "Removed/fixed unused variable references"

This commit is contained in:
Jenkins 2012-09-04 21:43:58 +00:00 committed by Gerrit Code Review
commit 15635261a4
4 changed files with 13 additions and 13 deletions

View File

@ -354,19 +354,16 @@ class DiabloAuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
def test_valid_diablo_response(self):
req = webob.Request.blank('/')
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)
class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
def assert_valid_request_200(self, token):
req = webob.Request.blank('/')
req.headers['X-Auth-Token'] = token
body = self.middleware(req.environ, self.start_fake_response)
self.assertEqual(self.response_status, 200)
catalog = req.headers.get('X-Service-Catalog')
self.assertTrue(req.headers.get('X-Service-Catalog'))
self.assertEqual(body, ['SUCCESS'])
@ -567,8 +564,3 @@ class AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest):
self.assertEqual(self.response_status, 200)
self.assertFalse(req.headers.get('X-Service-Catalog'))
self.assertEqual(body, ['SUCCESS'])
if __name__ == '__main__':
import unittest
unittest.main()

View File

@ -667,6 +667,14 @@ class TokenTests(object):
data = {'id_hash': token_id, 'id': token_id, 'a': 'b'}
data_ref = self.token_api.create_token(token_id, data)
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
def test_list_revoked_tokens_returns_empty_list(self):

View File

@ -626,7 +626,7 @@ class JsonTestCase(RestfulTestCase, CoreApiTests):
self.assertValidErrorResponse(r)
def test_fetch_revocation_list_nonadmin_fails(self):
r = self.admin_request(
self.admin_request(
method='GET',
path='/v2.0/tokens/revoked',
expected_status=401)

View File

@ -46,13 +46,13 @@ class UrlMiddlewareTest(test.TestCase):
"""Tests /v2.0/tokens and /v2.0/tokens/ normalized URLs match."""
req1 = webob.Request.blank('/v2.0/tokens')
req2 = webob.Request.blank('/v2.0/tokens/')
_ = self.middleware(req1.environ, self.start_fake_response)
_ = self.middleware(req2.environ, self.start_fake_response)
self.middleware(req1.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, 'http://localhost/v2.0/tokens')
def test_rewrite_empty_path(self):
"""Tests empty path is rewritten to root."""
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/')