Adding a regression test to prove https://github.com/dreamhost/pecan/issues/131
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user