def setUp(self): self.path = "/humgen/projects/serapis_staging/test-baton/test-collection-acls" BatonCollectionAPI.remove_all_acls(self.path) self.acl = ACL(user='******', zone='humgen', permission='READ') BatonCollectionAPI.add_or_replace_acl(self.path, self.acl) existing_acls = BatonCollectionAPI.get_acls(self.path) self.assertEqual(len(existing_acls), 1)
def test_get_or_replace_acls_when_replacing_an_acl(self): added_acl = ACL(user='******', zone='humgen', permission='OWN') BatonCollectionAPI.add_or_replace_acl(self.path, added_acl) acls_set = BatonCollectionAPI.get_acls(self.path) self.assertSetEqual(acls_set, {added_acl}) replacement_acl = ACL(user='******', zone='humgen', permission='READ') BatonCollectionAPI.add_or_replace_acl(self.path, replacement_acl) acls_set = BatonCollectionAPI.get_acls(self.path) self.assertSetEqual(acls_set, {replacement_acl})
def test_get_or_replace_acls_when_adding_a_new_acl(self): added_acl = ACL(user='******', zone='humgen', permission='OWN') BatonCollectionAPI.add_or_replace_acl(self.path, added_acl) acls_set = BatonCollectionAPI.get_acls(self.path) found = False for acl in acls_set: if acl == added_acl: found = True self.assertTrue(found)