def test_abort_error_no_data(self): app.config["TESTING"] = True self.app = app.test_client() with self.assertRaises(HTTPException) as http_error: # retrieve current API response to request self.assertEqual(geneInteraction.read_all_genes(disease_name="bladder urothelial carcinoma", ensg_number=['ENSG00000023041'], pValue = None), 404)
def test_abort_error_gene_type(self): app.config["TESTING"] = True self.app = app.test_client() with self.assertRaises(HTTPException) as http_error: # retrieve current API response to request self.assertEqual(geneInteraction.read_all_genes(gene_type="foobar", pValue = None), 404)
def test_abort_error_ensg_and_gene_symbol(self): app.config["TESTING"] = True self.app = app.test_client() with self.assertRaises(HTTPException) as http_error: # retrieve current API response to request self.assertEqual(geneInteraction.read_all_genes(ensg_number=["ENSGfoobar"],gene_symbol=["foobar"], pValue = None), 404)
def test_abort_error_limit(self): app.config["TESTING"] = True self.app = app.test_client() with self.assertRaises(HTTPException) as http_error: # retrieve current API response to request self.assertEqual( geneInteraction.read_all_genes(disease_name="foobar", limit=20000), 404)
def test_findAll_disease_and_gene_symbol(self): app.config["TESTING"] = True self.app = app.test_client() # retrieve correct database response to request mock_response = test_read_all_genes(disease_name='bladder urothelial carcinoma', gene_symbol=['CALB2','TIGAR'], limit=50, pValue = None) # retrieve current API response to request api_response = geneInteraction.read_all_genes(disease_name='bladder urothelial carcinoma', gene_symbol=['CALB2', 'TIGAR'], limit=50, pValue = None) # assert that the two output the same self.assertEqual(mock_response, api_response)
def test_findAll_disease_and_ensg(self): app.config["TESTING"] = True self.app = app.test_client() # retrieve correct database response to request mock_response = test_read_all_genes(disease_name='bladder urothelial carcinoma', ensg_number=['ENSG00000172137','ENSG00000078237'], limit=50, pValue = None) # retrieve current API response to request api_response = geneInteraction.read_all_genes(disease_name='bladder urothelial carcinoma', ensg_number=['ENSG00000172137', 'ENSG00000078237'], limit=50, pValue = None) # assert that the two output the same self.assertEqual(mock_response, api_response)
def test_findAll_disease_and_gene_type(self): app.config["TESTING"] = True self.app = app.test_client() # retrieve correct database response to request mock_response = test_read_all_genes( disease_name='bladder urothelial carcinoma', gene_type="protein_coding", limit=50) # retrieve current API response to request api_response = geneInteraction.read_all_genes( disease_name='bladder urothelial carcinoma', gene_type="protein_coding", limit=50) # assert that the two output the same self.assertEqual(mock_response, api_response)