Merge branch 'acl'
[invirt/packages/python-afs.git] / afs / tests / test_acl.py
1 import nose
2 import afs.acl as acl
3
4 def test_showRights():
5     assert acl.showRights(acl.READ | acl.WRITE) == "rw"
6
7 def test_crights():
8     assert acl.crights('read') & acl.READ
9     assert acl.crights('read') & acl.LOOKUP
10     assert not acl.crights('read') & acl.WRITE
11
12 def test_retrieve():
13     assert acl.ACL.retrieve('/afs/athena.mit.edu/contrib/bitbucket2').pos['system:anyuser'] & acl.WRITE
14     assert acl.ACL.retrieve('/afs/athena.mit.edu/user/t/a/tabbott').neg['yuranlu'] & acl.USR0
15
16 def test_getCallerAccess():
17     assert acl.getCallerAccess('/afs/athena.mit.edu/contrib/bitbucket2') & acl.WRITE
18
19 if __name__ == '__main__':
20     nose.main()
21