def test_count_total(self): # given: zero_map = EntityMap() # and: one_map = EntityMap() one_map.add_entity(Entity('product', 'product_1', {})) # and: three_map = EntityMap() three_map.add_entity(Entity('profile', 'profile_1', {})) for product_id in range(0, 2): three_map.add_entity(Entity('product', f'product_{product_id}', {})) # expect: self.assertEqual(0, zero_map.count_total()) self.assertEqual(1, one_map.count_total()) self.assertEqual(3, three_map.count_total())
def define_manifest(self, entity_map: EntityMap): # TODO provide a better way to serialize manifest_json = { 'totalCount': entity_map.count_total(), 'expectedBiomaterials': entity_map.count_entities_of_type('biomaterial'), 'expectedProcesses': entity_map.count_entities_of_type('process'), 'expectedFiles': entity_map.count_entities_of_type('file'), 'expectedProtocols': entity_map.count_entities_of_type('protocol'), 'expectedProjects': entity_map.count_entities_of_type('project'), 'expectedLinks': entity_map.count_links(), 'actualLinks': 0 } self.manifest = self.ingest_api.create_submission_manifest( self.submission_url, manifest_json) return self.manifest