From 4b2c4566977b1d810daa4a002a93058353f8b190 Mon Sep 17 00:00:00 2001 From: Vishakha Agarwal Date: Thu, 13 Sep 2018 08:30:39 +0530 Subject: [PATCH] Remove unused revoke_by_user_and_project This patch removes a method that wasn't being used anymore anywhere except for a single unit test. Since keystone now validates Fernet tokens the same way - by rebuilding the token context at validation time, we no longer need to persist certain types of revocation events. Change-Id: Ic9dcc6a5fd40e504ec04dcefab995d03927362bc partial-bug: #1671887 --- keystone/revoke/core.py | 4 ---- keystone/tests/unit/test_revoke.py | 31 ------------------------------ 2 files changed, 35 deletions(-) diff --git a/keystone/revoke/core.py b/keystone/revoke/core.py index c9f16a40de..a236364c4d 100644 --- a/keystone/revoke/core.py +++ b/keystone/revoke/core.py @@ -122,10 +122,6 @@ class Manager(manager.Manager): domain_id=domain_id, project_id=project_id)) - def revoke_by_user_and_project(self, user_id, project_id): - self.revoke( - revoke_model.RevokeEvent(project_id=project_id, user_id=user_id)) - def check_token(self, token): """Check the values from a token against the revocation list. diff --git a/keystone/tests/unit/test_revoke.py b/keystone/tests/unit/test_revoke.py index 1faad0270d..f5daf9397f 100644 --- a/keystone/tests/unit/test_revoke.py +++ b/keystone/tests/unit/test_revoke.py @@ -331,37 +331,6 @@ class RevokeTests(object): self.assertEqual( 1, len(revocation_backend.list_events(token=token_data))) - def test_by_project_and_user_and_role(self): - revocation_backend = sql.Revoke() - - first_token = _sample_blank_token() - first_token['user_id'] = uuid.uuid4().hex - first_token['project_id'] = uuid.uuid4().hex - - second_token = _sample_blank_token() - second_token['user_id'] = uuid.uuid4().hex - second_token['project_id'] = first_token['project_id'] - - # Check that both tokens have not been revoked. - self._assertTokenNotRevoked(first_token) - self._assertTokenNotRevoked(second_token) - self.assertEqual( - 0, len(revocation_backend.list_events(token=first_token))) - self.assertEqual( - 0, len(revocation_backend.list_events(token=second_token))) - - # Revoke first_token using user_id and project_id - PROVIDERS.revoke_api.revoke_by_user_and_project( - first_token['user_id'], first_token['project_id']) - - # Check that only first_token has been revoked. - self._assertTokenRevoked(first_token) - self._assertTokenNotRevoked(second_token) - self.assertEqual( - 1, len(revocation_backend.list_events(token=first_token))) - self.assertEqual( - 0, len(revocation_backend.list_events(token=second_token))) - def test_revoke_by_audit_id(self): token = _sample_blank_token() # Audit ID and Audit Chain ID are populated with the same value