aboutsummaryrefslogtreecommitdiffstats
path: root/keystone-moon/keystone/tests/unit/ksfixtures/cache.py
diff options
context:
space:
mode:
authorRuan HE <ruan.he@orange.com>2016-06-09 08:12:34 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-06-09 08:12:34 +0000
commit4bc079a2664f9a407e332291f34d174625a9d5ea (patch)
tree7481cd5d0a9b3ce37c44c797a1e0d39881221cbe /keystone-moon/keystone/tests/unit/ksfixtures/cache.py
parent2f179c5790fbbf6144205d3c6e5089e6eb5f048a (diff)
parent2e7b4f2027a1147ca28301e4f88adf8274b39a1f (diff)
Merge "Update Keystone core to Mitaka."
Diffstat (limited to 'keystone-moon/keystone/tests/unit/ksfixtures/cache.py')
-rw-r--r--keystone-moon/keystone/tests/unit/ksfixtures/cache.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/keystone-moon/keystone/tests/unit/ksfixtures/cache.py b/keystone-moon/keystone/tests/unit/ksfixtures/cache.py
index 74566f1e..e0833ae2 100644
--- a/keystone-moon/keystone/tests/unit/ksfixtures/cache.py
+++ b/keystone-moon/keystone/tests/unit/ksfixtures/cache.py
@@ -13,11 +13,17 @@
import fixtures
+from keystone import catalog
from keystone.common import cache
+CACHE_REGIONS = (cache.CACHE_REGION, catalog.COMPUTED_CATALOG_REGION)
+
+
class Cache(fixtures.Fixture):
- """A fixture for setting up and tearing down the cache between test cases.
+ """A fixture for setting up the cache between test cases.
+
+ This will also tear down an existing cache if one is already configured.
"""
def setUp(self):
@@ -29,8 +35,9 @@ class Cache(fixtures.Fixture):
# NOTE(morganfainberg): The only way to reconfigure the CacheRegion
# object on each setUp() call is to remove the .backend property.
- if cache.REGION.is_configured:
- del cache.REGION.backend
+ for region in CACHE_REGIONS:
+ if region.is_configured:
+ del region.backend
- # ensure the cache region instance is setup
- cache.configure_cache_region(cache.REGION)
+ # ensure the cache region instance is setup
+ cache.configure_cache(region=region)