Exemple #1
0
 def test_key_dict_unsupport(self):
     struct = yaml.load("""
     testing:
         admin:
             key:
                 wont:
                     work""")
     self.assertRaises(Exception, build_acl, struct)
     try:
         build_acl(struct)
     except Exception as e:
         assert 'not supported' in str(e)
Exemple #2
0
 def test_basic_key(self):
     struct = yaml.load("""
     testing:
         user:
             key: exists""")
     acl = build_acl(struct)
     assert 'key_exists' in acl['testing']['user']
Exemple #3
0
 def test_basic_inherit_role(self):
     struct = yaml.load("""
     testing:
         admin:
             inherit: user
         user:
             key:
                 - exists""")
     acl = build_acl(struct)
     assert 'key_exists' in acl['testing']['admin']
Exemple #4
0
 def test_basic_inherit_type(self):
     struct = yaml.load("""
     testing:
         user:
             key: exists
     testing2:
         inherit: testing
         user:
             key: also_exists""")
     acl = build_acl(struct)
     assert 'key_exists' in acl['testing2']['user']
Exemple #5
0
 def test_inherit_virtual(self):
     struct = yaml.load("""
     testing:
         virtual: true
         user:
             key: exists
     testing2:
         inherit: testing
         admin:
             inherit: user""")
     acl = build_acl(struct)
     assert 'testing' not in acl
     assert 'key_exists' in acl['testing2']['admin']
Exemple #6
0
 def test_inherit_virtual_inherit(self):
     struct = yaml.load("""
     testing:
         other:
             key2: exists
         user:
             key: exists
             inherit: other
     testing2:
         inherit: testing
         other:
             key3: exists
         admin:
             inherit: user""")
     acl = build_acl(struct)
     assert 'key3_exists' in acl['testing2']['admin']
     assert 'key2_exists' in acl['testing2']['admin']
Exemple #7
0
import yaml
from . import root

from lever import build_acl


acl_yaml = yaml.load(open(root + '/crowdlink/acl.yaml'))
acl = build_acl(acl_yaml)
Exemple #8
0
 def test_virtual_removal(self):
     struct = yaml.load("""
     testing:
         virtual: true""")
     acl = build_acl(struct)
     assert 'testing' not in acl