def test_search_datasets(self): """Ensures the responses from datasets search are well formed.""" request = self.factory.post("/data/ga4gh/datasets/search", content_type="application/json") response = views.search_datasets(request) json_response = json.loads(response.content) self.assertIsNotNone(json_response["datasets"]) for dataset in json_response["datasets"]: self.assertIsNotNone(dataset)
def test_search_datasets_paging(self): """Server dataset field should be empty, since server only supports one dataset """ request = self.factory.post( "/data/ga4gh/datasets/search", json.dumps({"pageSize": 1, "nextPageToken": "2"}), content_type="application/json") response = views.search_datasets(request) json_response = json.loads(response.content) # Note that it was asserted to an empty string, because it is not a none value. self.assertTrue(json_response.get("nextPageToken", None) is None)
def test_search_datasets(self): """Ensures the responses from datasets search are well formed.""" request = self.factory.post( "/data/ga4gh/datasets/search", content_type="application/json") response = views.search_datasets(request) json_response = json.loads(response.content) self.assertIsNotNone(json_response["datasets"]) for dataset in json_response["datasets"]: self.assertIsNotNone(dataset)
def test_datasets_alive(self): """Tests that datasets search endpoint is alive.""" request = self.factory.post("/data/ga4gh/datasets/search", json.dumps({"pageSize": 1}), content_type="application/json") response = views.search_datasets(request) self.assertEqual(response.status_code, 200) request_2 = self.factory.get("/data/ga4gh/datasets/brca") response_2 = views.get_dataset(request_2, "brca") self.assertEqual(response_2.status_code, 200)
def test_datasets_alive(self): """Tests that datasets search endpoint is alive.""" request = self.factory.post( "/data/ga4gh/datasets/search", json.dumps({"pageSize": 1}), content_type="application/json") response = views.search_datasets(request) self.assertEqual(response.status_code, 200) request_2 = self.factory.get( "/data/ga4gh/datasets/brca") response_2 = views.get_dataset(request_2, "brca") self.assertEqual(response_2.status_code, 200)