This commit is contained in:
Ryan Petrello
2012-04-04 11:20:41 -04:00
parent d5281c57dd
commit 7cd79ef308

View File

@@ -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