diff options
| author | John Anderson <sontek@gmail.com> | 2014-12-25 19:36:18 -0800 |
|---|---|---|
| committer | John Anderson <sontek@gmail.com> | 2014-12-25 19:36:18 -0800 |
| commit | c966a9283c2c6515848e8a5f4f7c34e0fba733a8 (patch) | |
| tree | 197e710d6172c1778ccd74c5d1a3d17072af4405 | |
| parent | 1264707de3f9fa2d15943da3bf321b1304556aa3 (diff) | |
| download | pyramid-c966a9283c2c6515848e8a5f4f7c34e0fba733a8.tar.gz pyramid-c966a9283c2c6515848e8a5f4f7c34e0fba733a8.tar.bz2 pyramid-c966a9283c2c6515848e8a5f4f7c34e0fba733a8.zip | |
Added test for the view glob
| -rw-r--r-- | pyramid/tests/test_scripts/test_proutes.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/pyramid/tests/test_scripts/test_proutes.py b/pyramid/tests/test_scripts/test_proutes.py index f7a85bd1c..4622383be 100644 --- a/pyramid/tests/test_scripts/test_proutes.py +++ b/pyramid/tests/test_scripts/test_proutes.py @@ -531,6 +531,47 @@ class TestPRoutesCommand(unittest.TestCase): ] self.assertEqual(compare_to, expected) + def test_view_glob(self): + from pyramid.renderers import null_renderer as nr + from pyramid.config import not_ + + def view1(context, request): return 'view1' + def view2(context, request): return 'view2' + + config = self._makeConfig(autocommit=True) + config.add_route('foo', '/a/b') + config.add_view( + route_name='foo', + view=view1, + renderer=nr, + request_method=not_('POST') + ) + + config.add_route('bar', '/b/a') + config.add_view( + route_name='bar', + view=view2, + renderer=nr, + request_method=not_('POST') + ) + + command = self._makeOne() + command.options.glob = '*foo*' + + L = [] + command.out = L.append + command.bootstrap = (dummy.DummyBootstrap(registry=config.registry),) + result = command.run() + self.assertEqual(result, 0) + self.assertEqual(len(L), 3) + compare_to = L[-1].split() + expected = [ + 'foo', '/a/b', + 'pyramid.tests.test_scripts.test_proutes.view1', + '!POST,*' + ] + self.assertEqual(compare_to, expected) + class Test_main(unittest.TestCase): def _callFUT(self, argv): from pyramid.scripts.proutes import main |
