Use fixture for mock patch
fixtures provides a MockPatchObject fixture that encapsulates the necessary cleanup, so use that rather to make the code simpler. Change-Id: Ibb1be532255131729198ff54fbd765e244c3ea8e
This commit is contained in:
parent
8aafe9802c
commit
80fd21b3cc
@ -16,7 +16,6 @@ import uuid
|
||||
import fixtures
|
||||
from keystoneauth1 import fixture as client_fixtures
|
||||
from keystoneclient import utils
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from keystonemiddleware import auth_token
|
||||
@ -35,13 +34,10 @@ class AuthTokenFixture(fixtures.Fixture):
|
||||
self._token_data = {}
|
||||
self.addCleanup(self._token_data.clear)
|
||||
_LOG.info('Using Testing AuthTokenFixture...')
|
||||
self.mockpatch = mock.patch.object(
|
||||
self.useFixture(fixtures.MockPatchObject(
|
||||
auth_token.AuthProtocol,
|
||||
'fetch_token',
|
||||
self.fetch_token)
|
||||
self.mockpatch.start()
|
||||
# Make sure we stop patching when we do the cleanup.
|
||||
self.addCleanup(self.mockpatch.stop)
|
||||
self.fetch_token))
|
||||
|
||||
@property
|
||||
def tokens(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user