summaryrefslogtreecommitdiff
path: root/pecan/tests/test_generic.py
diff options
context:
space:
mode:
Diffstat (limited to 'pecan/tests/test_generic.py')
-rw-r--r--pecan/tests/test_generic.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pecan/tests/test_generic.py b/pecan/tests/test_generic.py
index 453f123..19127fc 100644
--- a/pecan/tests/test_generic.py
+++ b/pecan/tests/test_generic.py
@@ -60,3 +60,29 @@ class TestGeneric(PecanTestCase):
r = app.delete('/', expect_errors=True)
assert r.status_int == 405
assert r.headers['Allow'] == 'GET, PATCH, POST'
+
+ def test_nested_generic(self):
+
+ class SubSubController(object):
+ @expose(generic=True)
+ def index(self):
+ return 'GET'
+
+ @index.when(method='DELETE', template='json')
+ def do_delete(self, name, *args):
+ return dict(result=name, args=', '.join(args))
+
+ class SubController(object):
+ sub = SubSubController()
+
+ class RootController(object):
+ sub = SubController()
+
+ app = TestApp(Pecan(RootController()))
+ r = app.get('/sub/sub/')
+ assert r.status_int == 200
+ assert r.body == b_('GET')
+
+ r = app.delete('/sub/sub/joe/is/cool')
+ assert r.status_int == 200
+ assert r.body == b_(dumps(dict(result='joe', args='is, cool')))