Esempio n. 1
0
 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)
Esempio n. 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')
     ]
     BatonCollectionAPI.add_or_replace_a_list_of_acls(self.path, self.acls)
     self.acls_set = BatonCollectionAPI.get_acls(self.path)
     self.assertEqual(len(self.acls_set), 2)
Esempio n. 3
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)
Esempio n. 4
0
 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)
Esempio n. 5
0
    def setUp(self):
        self.parent_coll = "/humgen/projects/serapis_staging/test-icmds/test-mk-rm-coll"
        self.coll_created = "/humgen/projects/serapis_staging/test-icmds/test-mk-rm-coll/new_coll"

        files = BatonCollectionAPI.list_collections(self.parent_coll)
        print("Files: %s" % files)
        self.assertFalse(self.coll_created in files)
Esempio n. 6
0
 def setUp(self):
     self.coll = "/humgen/projects/serapis_staging/test-icmds/test-imv"
     self.fpath = "/humgen/projects/serapis_staging/test-icmds/test-imv/original_name.txt"
     self.renamed_fpath = "/humgen/projects/serapis_staging/test-icmds/test-imv/renamed.txt"
     files = BatonCollectionAPI.list_data_objects(self.coll)
     self.assertEqual(len(files), 1)
     self.assertTrue(self.fpath in files)
Esempio n. 7
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)
Esempio n. 8
0
 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})
Esempio n. 9
0
 def tearDown(self):
     ICmdsCollectionAPI.remove(self.coll_created)
     contents = BatonCollectionAPI.list_collections(self.parent_coll)
     self.assertFalse(self.coll_created in contents)
Esempio n. 10
0
 def test_rm_metadata(self):
     BatonCollectionAPI.remove_metadata(self.coll_path, self.meta_dict)
     new_meta = BatonCollectionAPI.get_all_metadata(self.coll_path).to_dict()
     self.assertFalse('key1' in new_meta)
Esempio n. 11
0
 def setUp(self):
     self.path = "/humgen/projects/serapis_staging/test-baton/test-collection-acls"
     BatonCollectionAPI.remove_all_acls(self.path)
Esempio n. 12
0
 def tearDown(self):
     BatonCollectionAPI.remove_metadata(self.coll_path, self.meta_dict)
Esempio n. 13
0
 def test_copy(self):
     ICmdsDataObjectAPI.copy(self.orig_fpath, self.copy_fpath)
     files = BatonCollectionAPI.list_data_objects(self.coll)
     self.assertEqual(len(files), 2)
Esempio n. 14
0
 def test_upload(self):
     ICmdsDataObjectAPI.upload(self.src_path, self.dest_path)
     files = BatonCollectionAPI.list_data_objects(self.dest_coll)
     self.assertTrue(self.dest_path in files)
Esempio n. 15
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')])
Esempio n. 16
0
 def test_list_contents(self):
     contents = BatonCollectionAPI.list_data_objects(self.coll_path)
     self.assertEqual(len(contents), 1)
     self.assertEqual(contents[0], "/humgen/projects/serapis_staging/test-baton/test_coll_metadata/test_list_coll.txt")
Esempio n. 17
0
 def tearDown(self):
     BatonCollectionAPI.remove_metadata(self.coll_path, {'key1': {'val2'}})
Esempio n. 18
0
 def test_update_metadata(self):
     BatonCollectionAPI.update_metadata(self.coll_path, 'key1', {'val2'})
     crt_meta = BatonCollectionAPI.get_all_metadata(self.coll_path).to_dict()
     self.assertTrue('key1' in crt_meta)
     self.assertSetEqual(crt_meta['key1'], {'val2'})
Esempio n. 19
0
 def setUp(self):
     self.coll_path = "/humgen/projects/serapis_staging/test-baton/test_coll_metadata"
     self.meta_dict = {'key1': {'val1'}}
     BatonCollectionAPI.add_metadata(self.coll_path, self.meta_dict)
     crt_meta = BatonCollectionAPI.get_all_metadata(self.coll_path).to_dict()
     self.assertTrue('key1' in crt_meta)
Esempio n. 20
0
 def setUp(self):
     self.coll = "/humgen/projects/serapis_staging/test-icmds/test-icp/"
     self.orig_fpath = "/humgen/projects/serapis_staging/test-icmds/test-icp/original.txt"
     self.copy_fpath = "/humgen/projects/serapis_staging/test-icmds/test-icp/copy.txt"
     files = BatonCollectionAPI.list_data_objects(self.coll)
     self.assertEqual(1, len(files))
Esempio n. 21
0
 def test_remove_all_acls(self):
     BatonCollectionAPI.remove_all_acls(self.fpath)
     acls_set = BatonCollectionAPI.get_acls(self.fpath)
     self.assertEqual(set(), acls_set)
Esempio n. 22
0
 def tearDown(self):
     ICmdsDataObjectAPI.remove(self.copy_fpath)
     files = BatonCollectionAPI.list_data_objects(self.coll)
     self.assertEqual(len(files), 1)
Esempio n. 23
0
 def test_remove_acls_for_a_list_of_users(self):
     BatonCollectionAPI.remove_acls_for_a_list_of_users(self.path, [(self.acl.user, self.acl.zone)])
     existing_acls = BatonCollectionAPI.get_acls(self.path)
     self.assertEqual(0, len(existing_acls))
Esempio n. 24
0
 def test_move(self):
     ICmdsDataObjectAPI.move(self.fpath, self.renamed_fpath)
     files = BatonCollectionAPI.list_data_objects(self.coll)
     self.assertTrue(self.renamed_fpath in files)
     self.assertEqual(len(files), 1)
Esempio n. 25
0
 def tearDown(self):
     BatonCollectionAPI.remove_all_acls(self.path)
Esempio n. 26
0
 def test_create(self):
     ICmdsCollectionAPI.create(self.coll_created)
     contents = BatonCollectionAPI.list_collections(self.parent_coll)
     print("Contents: %s" % contents)
     self.assertTrue(self.coll_created in contents)
Esempio n. 27
0
 def test_add_metadata(self):
     BatonCollectionAPI.add_metadata(self.coll_path, self.meta_dict)
     crt_meta_dict = BatonCollectionAPI.get_all_metadata(self.coll_path).to_dict()
     self.assertTrue('key1' in crt_meta_dict)