summaryrefslogtreecommitdiff
path: root/keystonemiddleware/fixture.py
diff options
context:
space:
mode:
authorBrant Knudson <bknudson@us.ibm.com>2015-12-29 18:05:42 -0600
committerBrant Knudson <bknudson@us.ibm.com>2015-12-29 18:05:42 -0600
commit80fd21b3cc056fba12cfa476fd87335d31d12da6 (patch)
tree4f2155dfa67da6d2b41bd087069d7a05afeb41a4 /keystonemiddleware/fixture.py
parent8aafe9802c28869dfd2a5758acfeca681fc6d93a (diff)
downloadkeystonemiddleware-80fd21b3cc056fba12cfa476fd87335d31d12da6.tar.gz
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
Diffstat (limited to 'keystonemiddleware/fixture.py')
-rw-r--r--keystonemiddleware/fixture.py8
1 files changed, 2 insertions, 6 deletions
diff --git a/keystonemiddleware/fixture.py b/keystonemiddleware/fixture.py
index b7d1615..18fbb47 100644
--- a/keystonemiddleware/fixture.py
+++ b/keystonemiddleware/fixture.py
@@ -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):