Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add unit tests for the recognition of the 'enabled' setting.

  • Loading branch information...
commit 0b01c22fc8d413f1804959b46f744f2453f3a906 1 parent 2b78782
@rbcarson rbcarson authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 pyramid_beaker/tests.py
View
9 pyramid_beaker/tests.py
@@ -261,7 +261,8 @@ def test_add_cache_single_region_no_expire(self):
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})
+ 'type': 'memory', 'lock_dir': None,
+ 'enabled': True})
def test_add_cache_multiple_region(self):
from pyramid_beaker import set_cache_regions_from_settings
@@ -270,9 +271,11 @@ 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'
+ settings['cache.default_term.enabled'] = 'false'
set_cache_regions_from_settings(settings)
default_term = beaker.cache.cache_regions.get('default_term')
short_term = beaker.cache.cache_regions.get('short_term')
@@ -280,6 +283,7 @@ def test_add_cache_multiple_region(self):
int(settings['cache.short_term.expire']))
self.assertEqual(short_term.get('lock_dir'), settings['cache.lock_dir'])
self.assertEqual(short_term.get('type'), 'memory')
+ self.assertTrue(short_term.get('enabled'))
self.assertEqual(default_term.get('expire'),
int(settings['cache.default_term.expire']))
@@ -287,6 +291,7 @@ def test_add_cache_multiple_region(self):
settings['cache.lock_dir'])
self.assertEqual(default_term.get('type'),
settings['cache.default_term.type'])
+ self.assertFalse(default_term.get('enabled'))
def test_region_inherit_url(self):
from pyramid_beaker import set_cache_regions_from_settings
@@ -303,4 +308,4 @@ def test_region_inherit_url(self):
default_term = beaker.cache.cache_regions.get('default_term')
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'])
+ self.assertEqual(default_term.get('url'), settings['cache.url'])

0 comments on commit 0b01c22

Please sign in to comment.
Something went wrong with that request. Please try again.