def test_get_all_cytogenetic_bands(self): """ POSITIVE CASE - Test to check whether all cytobands are returned. """ expected_number_of_cytogenetic_bands = 11 response = self.client.get('/api/bands/') self.assert200(response) self.assertEqual(len(response.json), expected_number_of_cytogenetic_bands) validate_response200_payload(response, CYTOGENETIC_BAND_SCHEMA)
def test_get_cytogenetic_bands_for_human_chr(self): """ POSITIVE CASE - H. sapiens (human) and chromosome - return all available cytogenetic bands. """ expected_number_of_cytogenetic_bands = 5 response = self.client.get('api/bands/10090/1') self.assert200(response) self.assertEqual(len(response.json), expected_number_of_cytogenetic_bands) validate_response200_payload(response, CYTOGENETIC_BAND_SCHEMA)
def test_get_loci_by_valid_species_and_chromosome(self): """ Positive case: tests the endpoint when given a valid species ID (10090) and a valid chromosome (1). """ response = self.client.get('api/qtls/10090/1') self.assert200(response) self.assertGreater(len(response.json), 0) validate_response200_payload(response, QTLS_SCHEMA)
def test_get_loci_by_valid_species(self): """ Positive case: tests the endpoint when given a valid species ID, such as 10090 for M. musculus. """ response = self.client.get('api/qtls/10090') self.assert200(response) self.assertGreater(len(response.json), 0) validate_response200_payload(response, QTLS_SCHEMA)
def test_get_all_loci(self): """ Positive case: tests the endpoint when provided no parameters. """ response = self.client.get('api/qtls/') self.assert200(response) self.assertGreater(len(response.json), 0) validate_response200_payload(response, QTLS_SCHEMA)
def test_get_terms_by_valid_ontology_prefix(self): """ POSITIVE CASE: test the endpoint when provided a specific valid ontology symbol - GO (for Gene Ontology). :return: status 200 and a list of objects, each having fields ('id', 'name', 'namespace', 'def', 'descendants') """ response = self.client.get('/api/ontologies/terms/GO') self.assert200(response) self.assertGreater(len(response.json), 0) # validate response payload: field names and types validate_response200_payload(response, ontology_terms_schema.SCHEMA_ONT_TERMS)
def test_get_terms_metadata_by_valid_ontology_id(self): """ POSITIVE CASE: test the endpoint when provided a specific valid ontology term ID, such as GO:0002027. :return: status 200 and an object having fields ('namespace', 'def', 'descendants') """ # call the endpoint response = self.client.get('/api/ontologies/metadata/GO:0033862') self.assert200(response) self.assertGreater(len(response.json), 0) # validate response payload: field names and types validate_response200_payload(response, ontology_terms_schema.SCHEMA_ONT_METADATA)
def test_get_associated_genes_by_valid_species_and_ontology_term(self): """ POSITIVE CASE: test the endpoint provided a specific valid species taxonomy ID and a specific valid ontology term ID. :return: status 200 and a list of objects, each having fields as specified in 'expected_object_fields' """ # call the endpoint response = self.client.get( '/api/ontologies/associations/10090/GO:0046983') self.assert200(response) self.assertGreater(len(response.json), 0) # validate response payload: field names and types validate_response200_payload( response, ontology_terms_schema.SCHEMA_ONT_ASSOCIATIONS)