Michael Merickel
2013-03-19 038dcbaea40ee6e4526946115cc4c8c9bfb43c2f
add failing test for callable acl
1 files modified
9 ■■■■■ changed files
pyramid/tests/test_authorization.py 9 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_authorization.py
@@ -215,6 +215,15 @@
        result = sorted(
            policy.principals_allowed_by_permission(context, 'read'))
        self.assertEqual(result, [])
    def test_callable_acl(self):
        from pyramid.security import Allow
        context = DummyContext()
        fn = lambda self: [(Allow, 'bob', 'read')]
        context.__acl__ = fn.__get__(context, context.__class__)
        policy = self._makeOne()
        result = policy.permits(context, ['bob'], 'read')
        self.assertTrue(result)
        
class DummyContext: