diff options
| author | Chris McDonough <chrism@agendaless.com> | 2009-06-26 03:39:27 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2009-06-26 03:39:27 +0000 |
| commit | 25cbe149246aba58b5eba4c13dc67260f09d3862 (patch) | |
| tree | e1d3dcc01ef3847d7a39a7c04de8d65da77ab386 /repoze/bfg/tests/test_traversal.py | |
| parent | 1e40cf21f1bb41feee5f377db8b02a06657d2001 (diff) | |
| download | pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.tar.gz pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.tar.bz2 pyramid-25cbe149246aba58b5eba4c13dc67260f09d3862.zip | |
- Cause ``:segment`` matches in route paths to put a Unicode-decoded
and URL-dequoted value in the matchdict for the value matched.
Previously a non-decoded non-URL-dequoted string was placed in the
matchdict as the value.
- Cause ``*remainder`` matches in route paths to put a *tuple* in the
matchdict dictionary in order to be able to present Unicode-decoded
and URL-dequoted values for the traversal path. Previously a
non-decoded non-URL-dequoted string was placed in the matchdict as
the value.
Diffstat (limited to 'repoze/bfg/tests/test_traversal.py')
| -rw-r--r-- | repoze/bfg/tests/test_traversal.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/repoze/bfg/tests/test_traversal.py b/repoze/bfg/tests/test_traversal.py index 68b920fa4..4a4080aab 100644 --- a/repoze/bfg/tests/test_traversal.py +++ b/repoze/bfg/tests/test_traversal.py @@ -270,7 +270,7 @@ class ModelGraphTraverserTests(unittest.TestCase): self.assertEqual(result['virtual_root'], model) self.assertEqual(result['virtual_root_path'], ()) - def test_withroute_with_subpath(self): + def test_withroute_with_subpath_string(self): model = DummyContext() traverser = self._makeOne(model) environ = {'bfg.routes.matchdict': {'subpath':'/a/b/c'}} @@ -283,7 +283,20 @@ class ModelGraphTraverserTests(unittest.TestCase): self.assertEqual(result['virtual_root'], model) self.assertEqual(result['virtual_root_path'], ()) - def test_withroute_and_traverse(self): + def test_withroute_with_subpath_tuple(self): + model = DummyContext() + traverser = self._makeOne(model) + environ = {'bfg.routes.matchdict': {'subpath':('a', 'b', 'c')}} + result = traverser(environ) + self.assertEqual(result['context'], model) + self.assertEqual(result['view_name'], '') + self.assertEqual(result['subpath'], ('a', 'b','c')) + self.assertEqual(result['traversed'], ()) + self.assertEqual(result['root'], model) + self.assertEqual(result['virtual_root'], model) + self.assertEqual(result['virtual_root_path'], ()) + + def test_withroute_and_traverse_string(self): model = DummyContext() traverser = self._makeOne(model) environ = {'bfg.routes.matchdict': {'traverse':'foo/bar'}} @@ -296,6 +309,19 @@ class ModelGraphTraverserTests(unittest.TestCase): self.assertEqual(result['virtual_root'], model) self.assertEqual(result['virtual_root_path'], ()) + def test_withroute_and_traverse_tuple(self): + model = DummyContext() + traverser = self._makeOne(model) + environ = {'bfg.routes.matchdict': {'traverse':('foo', 'bar')}} + result = traverser(environ) + self.assertEqual(result['context'], model) + self.assertEqual(result['view_name'], 'foo') + self.assertEqual(result['subpath'], ('bar',)) + self.assertEqual(result['traversed'], ()) + self.assertEqual(result['root'], model) + self.assertEqual(result['virtual_root'], model) + self.assertEqual(result['virtual_root_path'], ()) + class FindInterfaceTests(unittest.TestCase): def _callFUT(self, context, iface): from repoze.bfg.traversal import find_interface |
