diff --git a/tests/test_auth_token_middleware.py b/tests/test_auth_token_middleware.py index db46a9a124..3182e695a1 100644 --- a/tests/test_auth_token_middleware.py +++ b/tests/test_auth_token_middleware.py @@ -352,19 +352,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']) @@ -565,8 +562,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() diff --git a/tests/test_backend.py b/tests/test_backend.py index 6d1e138766..508074b5d9 100644 --- a/tests/test_backend.py +++ b/tests/test_backend.py @@ -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): diff --git a/tests/test_content_types.py b/tests/test_content_types.py index bd17f17364..0371c556ee 100644 --- a/tests/test_content_types.py +++ b/tests/test_content_types.py @@ -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) diff --git a/tests/test_url_middleware.py b/tests/test_url_middleware.py index d27519dfd1..19f6141c94 100644 --- a/tests/test_url_middleware.py +++ b/tests/test_url_middleware.py @@ -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/')