summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_registry.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-10-03 20:11:06 +0000
committerChris McDonough <chrism@agendaless.com>2008-10-03 20:11:06 +0000
commit47b4d3ee62dfdb830a83192907b0602218f9ab5e (patch)
tree6fe0cce905bcc39f1ab431101fe419f4197305f9 /repoze/bfg/tests/test_registry.py
parent68fe4a3a211176a282212a441d04ab53227f6bd2 (diff)
downloadpyramid-47b4d3ee62dfdb830a83192907b0602218f9ab5e.tar.gz
pyramid-47b4d3ee62dfdb830a83192907b0602218f9ab5e.tar.bz2
pyramid-47b4d3ee62dfdb830a83192907b0602218f9ab5e.zip
Docs
- An "Environment and Configuration" chapter was added to the narrative portion of the documentation. Features - Ensure bfg doesn't generate warnings when running under Python 2.6. - The environment variable ``BFG_RELOAD_TEMPLATES`` is now available (serves the same purpose as ``reload_templates`` in the config file). - A new configuration file option ``debug_authorization`` was added. This turns on printing of security authorization debug statements to ``sys.stderr``. The ``BFG_DEBUG_AUTHORIZATION`` environment variable was also added; this performs the same duty. Bug Fixes - The environment variable ``BFG_SECURITY_DEBUG`` did not always work. It has been renamed to ``BFG_DEBUG_AUTHORIZATION`` and fixed. Deprecations - A deprecation warning is now issued when old API names from the ``repoze.bfg.templates`` module are imported. Backwards incompatibilities - The ``BFG_SECURITY_DEBUG`` environment variable was renamed to ``BFG_DEBUG_AUTHORIZATION``.
Diffstat (limited to 'repoze/bfg/tests/test_registry.py')
-rw-r--r--repoze/bfg/tests/test_registry.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/repoze/bfg/tests/test_registry.py b/repoze/bfg/tests/test_registry.py
index efc99b41a..d2e6b4caf 100644
--- a/repoze/bfg/tests/test_registry.py
+++ b/repoze/bfg/tests/test_registry.py
@@ -23,7 +23,8 @@ class TestMakeRegistry(unittest.TestCase, PlacelessSetup):
old = repoze.bfg.registry.setRegistryManager(dummyregmgr)
registry = makeRegistry('configure.zcml',
fixtureapp,
- options={'reload_templates':True},
+ options={'reload_templates':True,
+ 'debug_authorization':True},
lock=dummylock)
from zope.component.registry import Components
self.failUnless(isinstance(registry, Components))
@@ -32,8 +33,12 @@ class TestMakeRegistry(unittest.TestCase, PlacelessSetup):
self.assertEqual(dummyregmgr.registry, registry)
from zope.component import getUtility
from repoze.bfg.interfaces import ISettings
+ from repoze.bfg.interfaces import ILogger
settings = getUtility(ISettings)
+ logger = getUtility(ILogger, name='repoze.bfg.authdebug')
+ self.assertEqual(logger.name, 'repoze.bfg.authdebug')
self.assertEqual(settings.reload_templates, True)
+ self.assertEqual(settings.debug_authorization, True)
finally:
repoze.bfg.registry.setRegistryManager(old)
@@ -52,6 +57,27 @@ class TestGetOptions(unittest.TestCase):
self.assertEqual(result['reload_templates'], True)
result = get_options({'reload_templates':'1'})
self.assertEqual(result['reload_templates'], True)
+ result = get_options({}, {'BFG_RELOAD_TEMPLATES':'1'})
+ self.assertEqual(result['reload_templates'], True)
+ result = get_options({'reload_templates':'false'},
+ {'BFG_RELOAD_TEMPLATES':'1'})
+ self.assertEqual(result['reload_templates'], True)
+
+ def test_debug_authorization(self):
+ get_options = self._getFUT()
+ result = get_options({})
+ self.assertEqual(result['debug_authorization'], False)
+ result = get_options({'debug_authorization':'false'})
+ self.assertEqual(result['debug_authorization'], False)
+ result = get_options({'debug_authorization':'t'})
+ self.assertEqual(result['debug_authorization'], True)
+ result = get_options({'debug_authorization':'1'})
+ self.assertEqual(result['debug_authorization'], True)
+ result = get_options({}, {'BFG_DEBUG_AUTHORIZATION':'1'})
+ self.assertEqual(result['debug_authorization'], True)
+ result = get_options({'debug_authorization':'false'},
+ {'BFG_DEBUG_AUTHORIZATION':'1'})
+ self.assertEqual(result['debug_authorization'], True)
class TestThreadLocalRegistryManager(unittest.TestCase, PlacelessSetup):
def setUp(self):