summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_urldispatch.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-06-03 12:41:19 +0000
committerChris McDonough <chrism@agendaless.com>2009-06-03 12:41:19 +0000
commit6209577c528ad88b7f042b7454b630f08a093f63 (patch)
treec17286b4589422a814d5845eb4d6bb3f00ea016b /repoze/bfg/tests/test_urldispatch.py
parent421b51e20bb816f2ce5a2fc8efcff860ba4da91c (diff)
downloadpyramid-6209577c528ad88b7f042b7454b630f08a093f63.tar.gz
pyramid-6209577c528ad88b7f042b7454b630f08a093f63.tar.bz2
pyramid-6209577c528ad88b7f042b7454b630f08a093f63.zip
- The default routes context
(``repoze.bfg.urldispatch.DefaultRoutesContext``) object now subclasses from ``dict``. This means you can use the mapping protocol in views against it.
Diffstat (limited to 'repoze/bfg/tests/test_urldispatch.py')
-rw-r--r--repoze/bfg/tests/test_urldispatch.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_urldispatch.py b/repoze/bfg/tests/test_urldispatch.py
index 2b4578f94..3a1e4d497 100644
--- a/repoze/bfg/tests/test_urldispatch.py
+++ b/repoze/bfg/tests/test_urldispatch.py
@@ -1,6 +1,22 @@
import unittest
from repoze.bfg.testing import cleanUp
+class TestDefaultRoutesContextFactory(unittest.TestCase):
+ def _getTargetClass(self):
+ from repoze.bfg.urldispatch import DefaultRoutesContext
+ return DefaultRoutesContext
+
+ def _makeOne(self, **kw):
+ return self._getTargetClass()(kw)
+
+ def test_getattr(self):
+ inst = self._makeOne(a=1)
+ self.assertEqual(inst.a, 1)
+
+ def test_getattr_raises(self):
+ inst = self._makeOne(a=1)
+ self.assertRaises(AttributeError, inst.__getattr__, 'b')
+
class RoutesRootFactoryTests(unittest.TestCase):
def setUp(self):
cleanUp()