Mercurial > p > roundup > code
diff test/test_security.py @ 5269:c94fd717e28c
Fix http://issues.roundup-tracker.org/issue2550952 make __call__
method of a class usable as a check function.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 19 Sep 2017 22:00:20 -0400 |
| parents | 16a8a3f0772c |
| children | 64b05e24dbd8 |
line wrap: on
line diff
--- a/test/test_security.py Sat Sep 16 11:42:44 2017 -0400 +++ b/test/test_security.py Tue Sep 19 22:00:20 2017 -0400 @@ -181,8 +181,20 @@ prop = other['permission'] return (itemid == '1') + # also create a check as a callable of a class + # http://issues.roundup-tracker.org/issue2550952 + class CheckClass(object): + def __call__(self, db,userid,itemid, **other): + prop = other['property'] + prop = other['classname'] + prop = other['permission'] + return (itemid == '1') + addRole(name='Role3') - addToRole('Role3', add(name="Test", klass="test", check=check)) + # make sure check=CheckClass() and not check=CheckClass + # otherwise we get: + # inspectible <slot wrapper '__init__' of 'object' objects> + addToRole('Role3', add(name="Test", klass="test", check=CheckClass())) user3 = self.db.user.create(username='user3', roles='Role3') addRole(name='Role4')
