Permalink
Browse files

Added a test to ensure enabled was inherited.

  • Loading branch information...
mmerickel committed Nov 14, 2011
1 parent b86e0df commit 4d96cac158a3daf59d6ffffec13b74d1f4c8d254
Showing with 15 additions and 4 deletions.
  1. +15 −4 pyramid_beaker/tests.py
View
@@ -260,9 +260,9 @@ def test_add_cache_single_region_no_expire(self):
del settings['cache.default_term.expire']
set_cache_regions_from_settings(settings)
default_term = beaker.cache.cache_regions.get('default_term')
- self.assertEqual(default_term, {'url': None, 'expire': 60,
- 'type': 'memory', 'lock_dir': None,
- 'enabled': True})
+ self.assertEqual(default_term,
+ {'url': None, 'expire': 60, 'type': 'memory',
+ 'lock_dir': None, 'enabled': True})
def test_add_cache_multiple_region(self):
from pyramid_beaker import set_cache_regions_from_settings
@@ -271,7 +271,6 @@ def test_add_cache_multiple_region(self):
beaker.cache.cache_regions = {}
settings['cache.regions'] = 'default_term, short_term'
settings['cache.lock_dir'] = 'foo'
- settings['cache.enabled'] = 'true'
settings['cache.short_term.expire'] = '60'
settings['cache.default_term.type'] = 'file'
settings['cache.default_term.expire'] = '300'
@@ -309,6 +308,18 @@ def test_region_inherit_url(self):
short_term = beaker.cache.cache_regions.get('short_term')
self.assertEqual(short_term.get('url'), settings['cache.url'])
self.assertEqual(default_term.get('url'), settings['cache.url'])
+
+ def test_region_inherit_enabled(self):
+ from pyramid_beaker import set_cache_regions_from_settings
+ import beaker
+ settings = self._set_settings()
+ settings['cache.enabled'] = 'false'
+ beaker.cache.cache_regions = {}
+ set_cache_regions_from_settings(settings)
+ default_term = beaker.cache.cache_regions.get('default_term')
+ short_term = beaker.cache.cache_regions.get('short_term')
+ self.assertFalse(short_term.get('enabled'))
+ self.assertFalse(default_term.get('enabled'))
class TestIncludeMe(unittest.TestCase):
def test_includeme(self):

0 comments on commit 4d96cac

Please sign in to comment.