summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_scripting.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-27 14:03:07 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-27 14:03:07 +0000
commit711b60c05b9573f688994233ec1baac3f89bc45a (patch)
treec58595bc181ab52189b0cc096de099cf8e3bf167 /repoze/bfg/tests/test_scripting.py
parenta6ead8805b4de79edd0d980942894c0518104d5e (diff)
downloadpyramid-711b60c05b9573f688994233ec1baac3f89bc45a.tar.gz
pyramid-711b60c05b9573f688994233ec1baac3f89bc45a.tar.bz2
pyramid-711b60c05b9573f688994233ec1baac3f89bc45a.zip
Provide b/c for scripts which used ``registry_manager``
Diffstat (limited to 'repoze/bfg/tests/test_scripting.py')
-rw-r--r--repoze/bfg/tests/test_scripting.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_scripting.py b/repoze/bfg/tests/test_scripting.py
new file mode 100644
index 000000000..a54b4b7d9
--- /dev/null
+++ b/repoze/bfg/tests/test_scripting.py
@@ -0,0 +1,31 @@
+import unittest
+
+class TestGetRoot(unittest.TestCase):
+ def _callFUT(self, router):
+ from repoze.bfg.scripting import get_root
+ return get_root(router)
+
+ def test_it(self):
+ router = DummyRouter()
+ result = self._callFUT(router)
+ self.assertEqual(result, router)
+ self.assertEqual(len(router.threadlocal_manager.pushed), 1)
+ self.assertEqual(router.threadlocal_manager.pushed[0],
+ {'registry':None, 'request':None})
+
+
+class DummyThreadLocalManager:
+ def __init__(self):
+ self.pushed = []
+
+ def push(self, val):
+ self.pushed.append(val)
+
+class DummyRouter:
+ def __init__(self):
+ self.registry = None
+ self.threadlocal_manager = DummyThreadLocalManager()
+
+ def root_factory(self, environ):
+ return self
+