def test_get_files(self): ingest_api_mock = MagicMock(name='ingest_api') related_entity_map = {'derivedFiles': iter(['f1', 'f2'])} ingest_api_mock.get_assay_process = MagicMock() ingest_api_mock.get_related_entity = lambda f, relationship, t: related_entity_map.get( relationship) manifest = Manifest(ingest_api_mock, 'manifest_id') manifest.get_assay_process = MagicMock() files = manifest.get_files() self.assertEqual(files, ['f1', 'f2'])
def test_get_sequencing_protocol(self): ingest_api_mock = MagicMock(name='ingest_api') ingest_api_mock.get_file_by_uuid = MagicMock() related_entity_map = {'protocols': iter(['p1', 'p2'])} protocol_map = { 'p1': 'library_preparation_protocol', 'p2': 'sequencing_protocol' } ingest_api_mock.get_related_entity = lambda f, relationship, t: related_entity_map.get( relationship) ingest_api_mock.get_concrete_entity_type = lambda protocol: protocol_map.get( protocol) manifest = Manifest(ingest_api_mock, 'manifest_id') manifest.get_assay_process = MagicMock() protocol = manifest.get_sequencing_protocol() self.assertEqual(protocol, 'p2')