Beispiel #1
0
 def test_methods_to_perms_invalid_perm_name(self):
     with pytest.raises(ValueError) as ex:
         acl.methods_to_perms('foo,post', self.methods_map)
     expected = ("Unknown method name in permissions: "
                 "['foo', 'post']")
     assert expected in str(ex.value)
Beispiel #2
0
 def test_methods_to_perms(self):
     perms = acl.methods_to_perms('get', self.methods_map)
     assert perms == ['index']
     perms = acl.methods_to_perms('get,post', self.methods_map)
     assert sorted(perms) == ['create', 'index']
Beispiel #3
0
 def test_methods_to_perms_all_permissions(self):
     perms = acl.methods_to_perms('all,get,post', self.methods_map)
     assert perms is ALL_PERMISSIONS