示例#1
0
 def test_check_has_read_permission_ss_group_when_ok(self):
     acl1 = IrodsACL(access_group='ss_123#seq', zone='seq', permission='read')
     acl2 = IrodsACL(access_group='npg#seq', zone='seq', permission='own')
     acls=[acl1, acl2]
     result = IrodsRawFileMetadata.ACLsChecks.check_read_permission_exists_for_ss_group(acls)
     self.assertEqual(len(result), 2)
     for check_res in result:
         self.assertEqual(check_res.result, RESULT.SUCCESS)
示例#2
0
 def test_validate_fields_2(self):
     acl = IrodsACL(access_group='hgi', zone='seqhumgen', permission='read')
     check_results = acl.validate_fields()
     self.assertEqual(len(check_results), 2)
     for res in check_results:
         if res.check_name == CHECK_NAMES.check_irods_zone_within_acl:
             self.assertEqual(res.result, RESULT.FAILURE)
         else:
             self.assertEqual(res.result, RESULT.SUCCESS)
示例#3
0
 def test_check_has_read_permission_ss_group_no_ss_grp(self):
     acl1 = IrodsACL(access_group='public#seq', zone='seq', permission='read')
     acl2 = IrodsACL(access_group='npg#seq', zone='seq', permission='own')
     raw_metadata = IrodsRawFileMetadata(fpath='/home/myfile', acls=[acl1, acl2])
     result = raw_metadata.ACLsChecks.check_read_permission_exists_for_ss_group(raw_metadata.acls)
     self.assertEqual(len(result), 2)
     for check_res in result:
         if check_res.check_name in [CHECK_NAMES.check_ss_irods_group_read_permission, CHECK_NAMES.check_there_is_ss_irods_group]:
             self.assertEqual(check_res.result, RESULT.FAILURE)
         else:
             self.assertEqual(check_res.result, RESULT.SUCCESS)
示例#4
0
 def test_check_has_read_permission_ss_group_when_own_instead_of_read(self):
     acl1 = IrodsACL(access_group='ss_123#seq', zone='seq', permission='own')
     acl2 = IrodsACL(access_group='npg#seq', zone='seq', permission='own')
     acls=[acl1, acl2]
     result = IrodsRawFileMetadata.ACLsChecks.check_read_permission_exists_for_ss_group(acls)
     self.assertEqual(len(result), 2)
     for check_res in result:
         if check_res.check_name == CHECK_NAMES.check_ss_irods_group_read_permission:
             self.assertEqual(check_res.result, RESULT.FAILURE)
         else:
             self.assertEqual(check_res.result, RESULT.SUCCESS)
 def from_baton_wrapper(cls, data_object):
     fname = data_object.get_name()
     collection = data_object.get_collection_path()
     if data_object.replicas is not None:
         replicas = [
             IrodsFileReplica.from_baton_wrapper(replica)
             for replica in data_object.replicas
         ]
     else:
         replicas = []
     if data_object.access_controls is not None:
         acls = [
             IrodsACL.from_baton_wrapper(ac_item)
             for ac_item in data_object.access_controls if ac_item
         ]
     else:
         acls = []
     if data_object.metadata:
         avus = dict(data_object.metadata)
     else:
         avus = {}
     raw_meta = cls(fpath=os.path.join(collection, fname),
                    file_replicas=replicas,
                    acls=acls,
                    avus=avus)
     return raw_meta
示例#6
0
 def test_provides_own_permission_2(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='read')
     self.assertFalse((acl.provides_own_permission()))
示例#7
0
 def test_provides_own_permission_1(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='own')
     self.assertTrue(acl.provides_own_permission())
示例#8
0
 def test_provides_access_for_ss_group_2(self):
     acl = IrodsACL(access_group='ss_1234', zone='seq', permission='read')
     self.assertTrue(acl.provides_access_for_ss_group())
示例#9
0
 def test_provides_access_for_ss_group_1(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='own')
     self.assertFalse(acl.provides_access_for_ss_group())
示例#10
0
 def test_check_non_public_acls_when_not(self):
     acl1 = IrodsACL(access_group='ss_123#seq', zone='seq', permission='own')
     acl2 = IrodsACL(access_group='npg#seq', zone='seq', permission='own')
     acls = [acl1, acl2]
     result = IrodsRawFileMetadata.ACLsChecks.check_non_public_acls(acls)
     self.assertEqual(result.result, RESULT.SUCCESS)
示例#11
0
 def test_is_irods_zone_valid_1(self):
     self.assertTrue(IrodsACL._is_irods_zone_valid('seq'))
示例#12
0
 def test_is_permission_valid_2(self):
     acl = IrodsACL('hgi', 'seq', 'tralalala')
     actual_result = acl._is_permission_valid(acl.permission)
     expected_result = False
     self.assertEqual(actual_result, expected_result)
示例#13
0
 def test_validate_fields_1(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='read')
     check_results = acl.validate_fields()
     self.assertEqual(2, len(check_results))
     for res in check_results:
         self.assertEqual(res.result, RESULT.SUCCESS)
示例#14
0
 def test_is_irods_zone_valid_5(self):
     self.assertFalse(IrodsACL._is_irods_zone_valid('seqseqseq'))
示例#15
0
 def test_is_irods_zone_valid_4(self):
     self.assertFalse(IrodsACL._is_irods_zone_valid('blah'))
示例#16
0
 def test_provides_own_permission_4(self):
     acl = IrodsACL(access_group='hgi',
                    zone='blah',
                    permission='my_own_permission')
     self.assertRaises(ValueError, acl.provides_own_permission)
示例#17
0
 def test_is_permission_valid_1(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='read')
     self.assertTrue(IrodsACL._is_permission_valid(acl.permission))
示例#18
0
 def test_provides_public_access_1(self):
     acl = IrodsACL(access_group='hgi', zone='seq', permission='read')
     self.assertFalse(acl.provides_public_access())
示例#19
0
 def test_is_permission_valid_3(self):
     self.assertFalse(IrodsACL._is_permission_valid(''))
示例#20
0
 def test_provides_public_access_2(self):
     acl = IrodsACL(access_group='public', zone='humgen', permission='read')
     self.assertTrue(acl.provides_public_access())
示例#21
0
 def test_is_irods_zone_valid_2(self):
     self.assertTrue(IrodsACL._is_irods_zone_valid('humgen'))
示例#22
0
 def test_check_non_public_acls_when_there_are(self):
     acl = IrodsACL(access_group='public#seq', zone='seq', permission='own')
     acls=[acl]
     #raw_metadata = IrodsRawFileMetadata(fname='myfile', dir_path='/home', acls=[acl])
     result = IrodsRawFileMetadata.ACLsChecks.check_non_public_acls(acls)
     self.assertEqual(result.result, RESULT.FAILURE)