6033N/A keystone/tests/unit/test_backend.py | 39 ++++++++++++++++++++----------
6033N/A keystone/token/persistence/backends/kvs.py | 9 +++++++
6033N/A keystone/token/persistence/backends/sql.py | 12 ++++++++-
6033N/A+ 'audit_ids': [uuid.uuid4().hex]}}}}
6033N/A data_ref = self.token_provider_api._persistence.create_token(token_id,
6033N/A expires = data_ref.pop('expires')
6033N/A+ 'access': {'token': {'audit_ids': [uuid.uuid4().hex]}}}
6033N/A- data.setdefault('access', {}).setdefault('trust', {})
6033N/A self.assertEqual(data_ref, new_data_ref)
6033N/A- for x in self.token_provider_api.list_revoked_tokens()]
6033N/A+ revocation_list = self.token_provider_api.list_revoked_tokens()
6033N/A self.assertIn(token_id, revoked_ids)
6033N/A+ self.assertIn(audit_id, revoked_audit_ids)
6033N/A token_id = uuid.uuid4().hex
6033N/A+ audit_id = uuid.uuid4().hex
6033N/A data_ref = self.token_provider_api._persistence.create_token(token_id,
6033N/A+ 'audit_ids': [uuid.uuid4().hex]}}}
6033N/A token2_id = uuid.uuid4().hex
6033N/A+ 'audit_ids': [uuid.uuid4().hex]}}}
6033N/A- token = {'user': {'id': uuid.uuid4().hex}}
6033N/A+ token = {'user': {'id': uuid.uuid4().hex},
6033N/A+ 'token_data': {'token': {'audit_ids': [uuid.uuid4().hex]}}}
6033N/A self.token_provider_api._persistence.create_token(token_id, token)
6033N/A token_id = uuid.uuid4().hex
6033N/A- token = {'user': {'id': uuid.uuid4().hex}}
6033N/A+ token = {'user': {'id': uuid.uuid4().hex},
6033N/A+ 'token_data': {'token': {'audit_ids': [uuid.uuid4().hex]}}}
6033N/A self.token_provider_api._persistence.create_token(token_id, token)
6033N/Adiff --git a/keystone/tests/unit/test_backend_sql.py b/keystone/tests/unit/test_backend_sql.py
6033N/A@@ -441,7 +441,8 @@ class SqlToken(SqlTests, test_backend.TokenTests):
6033N/A expected_query_args = (token_sql.TokenModel.id,
6033N/A with mock.patch.object(token_sql, 'sql') as mock_sql:
6033N/A tok = token_sql.Token()
6033N/Adiff --git a/keystone/token/persistence/backends/kvs.py b/keystone/token/persistence/backends/kvs.py
6033N/A@@ -211,6 +211,15 @@ class Token(token.persistence.Driver):
6033N/A token_list = self._get_key_or_default(self.revocation_key, default=[])
6033N/Adiff --git a/keystone/token/persistence/backends/sql.py b/keystone/token/persistence/backends/sql.py
6033N/A@@ -228,13 +228,23 @@ class Token(token.persistence.Driver):
6033N/A session = sql.get_session()
6033N/A now = timeutils.utcnow()
6033N/A token_references = query.filter_by(valid=False)
6033N/A tokens.append(record)