예제 #1
0
 def test_get_acls_collection(self):
     # TODO: modify the test so that it removes everything, and then adds the ACls before checking on their existence
     result = BatonCollectionAPI._get_acls(self.path)
     expected = {
                 ACL(user='******', zone='humgen', permission='OWN'),
                 ACL(user='******', zone='Sanger1', permission='READ'),
     }
     self.assertSetEqual(result, expected)
예제 #2
0
 def test_add_or_replace_a_list_of_acls(self):
     self.acls = [
         ACL(user='******', zone='humgen', permission='READ'),
         ACL(user='******', zone='humgen', permission='READ')
     ]
     BatonDataObjectAPI.add_or_replace_a_list_of_acls(self.fpath, self.acls)
     self.acls_set = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertEqual(len(self.acls_set), 2)
예제 #3
0
 def test_get_or_replace_acls_when_replacing_an_acl(self):
     added_acl = ACL(user='******', zone='humgen', permission='OWN')
     BatonDataObjectAPI.add_or_replace_acl(self.fpath, added_acl)
     acls_set = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertSetEqual(acls_set, {added_acl})
     replacement_acl = ACL(user='******', zone='humgen', permission='READ')
     BatonDataObjectAPI.add_or_replace_acl(self.fpath, replacement_acl)
     acls_set = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertSetEqual(acls_set, {replacement_acl})
예제 #4
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test-collection-acls"
     self.acls = [
         ACL(user='******', zone='humgen', permission='READ'),
         ACL(user='******', zone='humgen', permission='READ')
     ]
     BatonCollectionAPI.add_or_replace_a_list_of_acls(self.fpath, self.acls)
     self.acls_set = BatonCollectionAPI.get_acls(self.fpath)
     self.assertNotEqual(len(self.acls_set), 0)
예제 #5
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test_add_acls.txt"
     BatonDataObjectAPI.remove_all_acls(self.fpath)
     self.acl = ACL(user='******', zone='humgen', permission='READ')
     BatonDataObjectAPI.add_or_replace_acl(self.fpath, self.acl)
     existing_acls = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertEqual(len(existing_acls), 1)
예제 #6
0
 def test_get_or_replace_acls_when_adding_a_new_acl(self):
     added_acl = ACL(user='******', zone='humgen', permission='OWN')
     BatonDataObjectAPI.add_or_replace_acl(self.fpath, added_acl)
     acls_set = BatonDataObjectAPI.get_acls(self.fpath)
     found = False
     for acl in acls_set:
         if acl == added_acl:
             found = True
     self.assertTrue(found)
예제 #7
0
 def test_get_acls_data_object(self):
     result = BatonDataObjectAPI._get_acls("/humgen/projects/serapis_staging/test-baton/test_acls.txt")
     expected = {ACL(user='******', zone='humgen', permission='READ'),
                 ACL(user='******', zone='Sanger1', permission='READ'),
                 ACL(user='******', zone='humgen', permission='OWN'),
                 ACL(user='******', zone='Sanger1', permission='OWN'),
                 ACL(user='******', zone='humgen', permission='OWN'),
                 ACL(user='******', zone='humgen', permission='OWN')
     }
     self.assertSetEqual(result, expected)
예제 #8
0
 def from_baton(acl):
     return ACL(user=acl.user.name,
                zone=acl.user.zone,
                permission=acl.level.name)
예제 #9
0
 def test_to_baton_when_ok(self):
     acl = ACL(user='******', zone='Sanger1', permission='OWN')
     result = ACLMapping.to_baton(acl)
     expected = AccessControl(User('ic4', 'Sanger1'),
                              AccessControl.Level.OWN)
     self.assertEqual(result, expected)
예제 #10
0
 def test_from_baton_when_more_acls(self):
     baton_acl = AccessControl(User('ic4', 'Sanger1'),
                               AccessControl.Level.WRITE)
     result = ACLMapping.from_baton(baton_acl)
     expected = ACL(user='******', zone='Sanger1', permission='WRITE')
     self.assertEqual(result, expected)
예제 #11
0
 def test_from_baton_when_ok(self):
     baton_acl = AccessControl(User('ic4', 'humgen'),
                               AccessControl.Level.READ)
     serapis_acl = ACLMapping.from_baton(baton_acl)
     expected = ACL(user='******', zone='humgen', permission='READ')
     self.assertEqual(serapis_acl, expected)
예제 #12
0
 def setUp(self):
     self.path = "/humgen/projects/serapis_staging/test-baton/test-collection-acls"
     BatonCollectionAPI.remove_all_acls(self.path)
     BatonCollectionAPI.add_or_replace_a_list_of_acls(self.path,
                                                      [ACL(user='******', zone='humgen', permission='OWN'),
                                                     ACL(user='******', zone='Sanger1', permission='READ')])