summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_paster.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-05-28 13:49:18 +0000
committerChris McDonough <chrism@agendaless.com>2009-05-28 13:49:18 +0000
commit82fefc4220a26b37484d2c79db4fdaeb9aebf7e9 (patch)
treef58149ef83b2bd8748751230d6691dc442100d08 /repoze/bfg/tests/test_paster.py
parent5968cd6ab617d6b25a43cd3bd3866d4a8f635638 (diff)
downloadpyramid-82fefc4220a26b37484d2c79db4fdaeb9aebf7e9.tar.gz
pyramid-82fefc4220a26b37484d2c79db4fdaeb9aebf7e9.tar.bz2
pyramid-82fefc4220a26b37484d2c79db4fdaeb9aebf7e9.zip
- Add a ``get_app`` API functions to the ``paster`` module. This
obtains a WSGI application from a config file given a config file name and a section name. See the ``repoze.bfg.paster`` API docs for more information. - Add a new module named ``scripting``. It contains a ``get_root`` API function, which, provided a Router instance, returns a traversal root object and a "closer". See the ``repoze.bfg.scripting`` API docs for more info.
Diffstat (limited to 'repoze/bfg/tests/test_paster.py')
-rw-r--r--repoze/bfg/tests/test_paster.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_paster.py b/repoze/bfg/tests/test_paster.py
index 3339fe498..0119e3313 100644
--- a/repoze/bfg/tests/test_paster.py
+++ b/repoze/bfg/tests/test_paster.py
@@ -28,6 +28,21 @@ class TestBFGShellCommand(unittest.TestCase):
self.failUnless(interact.banner)
self.assertEqual(len(app.threadlocal_manager.popped), 1)
+class TestGetApp(unittest.TestCase):
+ def _callFUT(self, config_file, section_name, loadapp):
+ from repoze.bfg.paster import get_app
+ return get_app(config_file, section_name, loadapp)
+
+ def test_it(self):
+ import os
+ app = DummyApp()
+ loadapp = DummyLoadApp(app)
+ result = self._callFUT('/foo/bar/myapp.ini', 'myapp', loadapp)
+ self.assertEqual(loadapp.config_name, 'config:/foo/bar/myapp.ini')
+ self.assertEqual(loadapp.section_name, 'myapp')
+ self.assertEqual(loadapp.relative_to, os.getcwd())
+ self.assertEqual(result, app)
+
class Dummy:
pass