summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2015-02-17 20:15:11 -0500
committerChris McDonough <chrism@plope.com>2015-02-17 20:15:11 -0500
commita8fab3816726affaee2a8b91037372ba77cc1487 (patch)
tree13ae79b9b2e00e57e102ac09f51bc9046074c9a4
parent0bf2fded1a5dfa1614120c989f1d051908fa0b56 (diff)
downloadpyramid-a8fab3816726affaee2a8b91037372ba77cc1487.tar.gz
pyramid-a8fab3816726affaee2a8b91037372ba77cc1487.tar.bz2
pyramid-a8fab3816726affaee2a8b91037372ba77cc1487.zip
add functest for config reentrancy
-rw-r--r--pyramid/tests/test_config/test_init.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/pyramid/tests/test_config/test_init.py b/pyramid/tests/test_config/test_init.py
index 2930734fa..4eb3f3385 100644
--- a/pyramid/tests/test_config/test_init.py
+++ b/pyramid/tests/test_config/test_init.py
@@ -1554,6 +1554,35 @@ class TestActionState(unittest.TestCase):
(3, g, (8,)),
])
+class Test_reentrant_action_functional(unittest.TestCase):
+ def _makeConfigurator(self, *arg, **kw):
+ from pyramid.config import Configurator
+ config = Configurator(*arg, **kw)
+ return config
+
+ def test_functional(self):
+ def add_auto_route(config, name, view):
+ def register():
+ config.add_view(route_name=name, view=view)
+ config.add_route(name, '/' + name)
+ config.action(
+ ('auto route', name), register, order=-30
+ )
+ config = self._makeConfigurator()
+ config.add_directive('add_auto_route', add_auto_route)
+ def my_view(request):
+ return request.response
+ config.add_auto_route('foo', my_view)
+ config.commit()
+ from pyramid.interfaces import IRoutesMapper
+ mapper = config.registry.getUtility(IRoutesMapper)
+ routes = mapper.get_routes()
+ route = routes[0]
+ self.assertEqual(len(routes), 1)
+ self.assertEqual(route.name, 'foo')
+ self.assertEqual(route.path, '/foo')
+
+
class Test_resolveConflicts(unittest.TestCase):
def _callFUT(self, actions):
from pyramid.config import resolveConflicts