Ejemplo n.º 1
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)
Ejemplo 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')
     ]
     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)
Ejemplo n.º 3
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test_add_acls.txt"
     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.assertNotEqual(len(self.acls_set), 0)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
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})
Ejemplo n.º 7
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test_add_acls.txt"
     BatonDataObjectAPI.remove_all_acls(self.fpath)
Ejemplo n.º 8
0
 def test_remove_all_acls(self):
     BatonDataObjectAPI.remove_all_acls(self.fpath)
     acls_set = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertEqual(set(), acls_set)
Ejemplo n.º 9
0
 def test_update_metadata(self):
     BatonDataObjectAPI.update_metadata(self.fpath, 'uniq_key', {'second_value'})
     updated_meta = BatonDataObjectAPI.get_all_metadata(self.fpath)
     values = updated_meta.get_avu('uniq_key')
     self.assertEqual(values, {'second_value'})
Ejemplo n.º 10
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test_metadata_add_rm.txt"
     BatonDataObjectAPI.add_metadata(self.fpath, {'uniq_key': {'first_value'}})
Ejemplo n.º 11
0
 def test_remove_metadata(self):
     BatonDataObjectAPI.remove_metadata(self.fpath, self.meta_dict)
     crt_meta = BatonDataObjectAPI.get_all_metadata(self.fpath)
     self.assertEqual(crt_meta, self.previous_meta)
Ejemplo n.º 12
0
 def setUp(self):
     self.fpath = "/humgen/projects/serapis_staging/test-baton/test_metadata_add_rm.txt"
     self.meta_dict = {'sample': {'sample2'}, 'sample_id': {'-1'}}
     self.previous_meta = BatonDataObjectAPI.get_all_metadata(self.fpath)
     BatonDataObjectAPI.add_metadata(self.fpath, self.meta_dict)
Ejemplo n.º 13
0
 def tearDown(self):
     BatonDataObjectAPI.remove_metadata(self.fpath, self.meta_dict)
Ejemplo n.º 14
0
 def test_add_metadata(self):
     BatonDataObjectAPI.add_metadata(self.fpath, self.meta_dict)
     metadata = BatonDataObjectAPI.get_all_metadata(self.fpath).to_dict()
     self.assertDictEqual(self.meta_dict, metadata)
Ejemplo n.º 15
0
 def test_remove_acls_for_a_list_of_users(self):
     BatonDataObjectAPI.remove_acls_for_a_list_of_users(self.fpath, [(self.acl.user, self.acl.zone)])
     existing_acls = BatonDataObjectAPI.get_acls(self.fpath)
     self.assertEqual(0, len(existing_acls))
Ejemplo n.º 16
0
 def tearDown(self):
     BatonDataObjectAPI.remove_all_acls(self.fpath)
Ejemplo n.º 17
0
 def tearDown(self):
     BatonDataObjectAPI.remove_metadata(self.fpath, {'uniq_key': {'second_value'}})