예제 #1
0
 def test_from_baton_wrapper_file_replicas(self):
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc"),
         baton_models.DataObjectReplica(number=2, checksum="abc"),]
     data_obj = baton_models.DataObject(path='/humgen/projects/helic/123.bam', replicas=replicas)
     raw_meta = IrodsRawFileMetadata.from_baton_wrapper(data_obj)
     self.assertEqual(len(raw_meta.file_replicas), 2)
예제 #2
0
 def test_check_more_than_one_replicas_when_ok(self):
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc"),
         baton_models.DataObjectReplica(number=2, checksum="abc")]
     raw_metadata = IrodsRawFileMetadata(fpath='/seq/123/123.cram', file_replicas=replicas)
     result = raw_metadata.ReplicasChecks.check_more_than_one_replicas(raw_metadata.file_replicas)
     self.assertEqual(result.result, RESULT.SUCCESS)
예제 #3
0
 def test_from_raw_metadata_only_replicas(self):
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc"),
         baton_models.DataObjectReplica(number=2, checksum="abc"),]
     raw_metadata = IrodsRawFileMetadata(fpath='/seq/123.bam', file_replicas=replicas)
     seq_metadata = IrodsSeqFileMetadata.from_raw_metadata(raw_metadata)
     expected = {'name': set(), 'accession_number': set(), 'internal_id': set()}
     self.assertEqual(seq_metadata.samples, expected)
     self.assertEqual(seq_metadata.libraries, expected)
     self.assertEqual(seq_metadata.checksum_in_meta, set())
예제 #4
0
 def test_from_baton_wrapper_full_obj(self):
     user = "******"
     acl = [baton_models.AccessControl(user, level=baton_models.AccessControl.Level.OWN)]
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc", host='hgi-dev', resource_name='irods-s1', up_to_date=True),
         baton_models.DataObjectReplica(number=2, checksum="abc", host='hgi-dev-wow', resource_name='irods-s2', up_to_date=True),]
     metadata = baton_coll.IrodsMetadata({'study': set(['BLUEPRINT'])})
     data_obj = baton_models.DataObject(path='/somepath/file.txt', access_controls=acl, metadata=metadata, replicas=replicas)
     raw_meta = IrodsRawFileMetadata.from_baton_wrapper(data_obj)
     self.assertEqual(raw_meta.fpath, '/somepath/file.txt')
     self.assertEqual(len(raw_meta.file_replicas), 2)
     self.assertEqual(len(raw_meta.acls), 1)
     self.assertEqual(raw_meta.acls[0].zone, 'humgen')
     self.assertEqual(raw_meta.acls[0].access_group, 'hgi')
예제 #5
0
 def test_from_baton_wrapper_missing_bits(self):
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc", host='hgi-dev', resource_name='irods-s1', up_to_date=True)]
     metadata = baton_coll.IrodsMetadata({'study': set(['BLUEPRINT'])})
     data_obj = baton_models.DataObject(path='/somepath/file.txt', metadata=metadata, replicas=replicas)
     raw_meta = IrodsRawFileMetadata.from_baton_wrapper(data_obj)
     self.assertEqual(len(raw_meta.file_replicas), 1)
     self.assertEqual(len(raw_meta.acls), 0)
예제 #6
0
 def test_from_baton_wrapper_all_ok(self):
     user = "******"
     acl = [baton_models.AccessControl(user, level=baton_models.AccessControl.Level.OWN)]
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc", host='hgi-dev', resource_name='irods-s1', up_to_date=True)]
     data_obj = baton_models.DataObject(path='/somepath/file.txt', access_controls=acl, replicas=replicas)
     raw_meta = IrodsRawFileMetadata.from_baton_wrapper(data_obj)
     self.assertEqual(raw_meta.fpath, '/somepath/file.txt')
     self.assertEqual(len(raw_meta.file_replicas), 1)
     self.assertEqual(len(raw_meta.acls), 1)
     self.assertEqual(raw_meta.acls[0].zone, 'humgen')
     self.assertEqual(raw_meta.acls[0].access_group, 'serapis')
예제 #7
0
 def test_check_more_than_one_replicas_when_ok(self):
     replicas = [
         baton_models.DataObjectReplica(number=1, checksum="123abc"),
         baton_models.DataObjectReplica(number=2, checksum="abc"),]
     result = IrodsRawFileMetadata.ReplicasChecks.check_more_than_one_replicas(replicas)
     self.assertEqual(result.result, RESULT.SUCCESS)