From 82fefc4220a26b37484d2c79db4fdaeb9aebf7e9 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Thu, 28 May 2009 13:49:18 +0000 Subject: - 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. --- repoze/bfg/tests/test_paster.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'repoze/bfg/tests/test_paster.py') 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 -- cgit v1.2.3