From 7cd79ef3081717dfe43bf22d4e6e6f4f6ba08f64 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 4 Apr 2012 11:20:41 -0400 Subject: [PATCH] Adding a regression test to prove https://github.com/dreamhost/pecan/issues/131 --- pecan/tests/test_secure.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/pecan/tests/test_secure.py b/pecan/tests/test_secure.py index 7aca4eb..86a2ca5 100644 --- a/pecan/tests/test_secure.py +++ b/pecan/tests/test_secure.py @@ -392,3 +392,32 @@ class TestObjectPathSecurity(TestCase): response = self.app.get('/notsecret/unlocked/') assert response.status_int == 200 assert response.body == 'Index unlocked' + + +class SecureControllerSharedPermissionsRegression(TestCase): + """Regression tests for https://github.com/dreamhost/pecan/issues/131""" + + def setUp(self): + class Parent(object): + @expose() + def index(self): + return 'hello' + + class UnsecuredChild(Parent): + pass + + class SecureChild(Parent, SecureController): + @classmethod + def check_permissions(cls): + return False + + class RootController(object): + + secured = SecureChild() + unsecured = UnsecuredChild() + + self.app = TestApp(make_app(RootController())) + + def test_inherited_security(self): + assert self.app.get('/secured/', status=401).status_int == 401 + assert self.app.get('/unsecured/').status_int == 200