def test_get_schema_type(self): # given schema_template = MagicMock(name='schema_template') ingest_api = MagicMock(name='ingest_api') spec = { 'schema': { 'high_level_entity': 'type', 'domain_entity': 'biomaterial', 'module': 'donor_organism', 'url': 'https://schema.humancellatlas.org/type/biomaterial/5.0.0/donor_organism' } } schema_template.lookup = MagicMock(name='lookup', return_value=spec) template_manager = TemplateManager(schema_template, ingest_api) # when: domain_entity = template_manager.get_domain_type('cell_suspension') # then: self.assertEqual('biomaterial', domain_entity)
def test_get_domain_type(self): # given: template = MagicMock(name='schema_template') schema_spec = {'schema': {'domain_entity': 'user/profile'}} template.lookup = MagicMock(return_value=schema_spec) # and: template_manager = TemplateManager(template, MagicMock(name='ingest_api')) # expect: self.assertEqual('user', template_manager.get_domain_type('profile'))