aboutsummaryrefslogtreecommitdiff
path: root/tests/integration
diff options
context:
space:
mode:
authorAlexander Kabui2021-05-02 23:54:56 +0300
committerAlexander Kabui2021-05-02 23:54:56 +0300
commit9f24b15064bcebcda9cf2164ab7b7e89644e3103 (patch)
tree7c36e4fd5b08720cfd0805352d56ca7cb1fc757b /tests/integration
parentf0ccff2a90d760fc0b268e715e0c6c673ff64e15 (diff)
downloadgenenetwork3-9f24b15064bcebcda9cf2164ab7b7e89644e3103.tar.gz
delete dataset and trait files
Diffstat (limited to 'tests/integration')
-rw-r--r--tests/integration/test_datasets.py41
-rw-r--r--tests/integration/test_traits.py72
2 files changed, 0 insertions, 113 deletions
diff --git a/tests/integration/test_datasets.py b/tests/integration/test_datasets.py
deleted file mode 100644
index f97d970..0000000
--- a/tests/integration/test_datasets.py
+++ /dev/null
@@ -1,41 +0,0 @@
-"""This module contains integration tests for datasets"""
-from unittest import TestCase
-from unittest import mock
-
-from collections import namedtuple
-from gn3.app import create_app
-
-
-class DatasetIntegrationTests(TestCase):
- """class contains integration tests for datasets"""
-
- def setUp(self):
- self.app = create_app().test_client()
-
- @mock.patch("gn3.api.datasets.create_dataset")
- def test_create_dataset(self, mock_dataset):
- """Test for creating dataset object"""
- mock_dataset_creator = namedtuple(
- 'ProbeSet', ["dataset_name", "dataset_type"])
- new_dataset = mock_dataset_creator("HC_M2_0606_P", "ProbeSet")
- mock_dataset.return_value = new_dataset
- response = self.app.get(
- "/api/dataset/create/HC_M2_0606_P/", follow_redirects=True)
- mock_dataset.assert_called_once_with(
- dataset_type=None, dataset_name="HC_M2_0606_P")
- results = response.get_json()["dataset"]
- self.assertEqual(results[1], "ProbeSet")
- self.assertEqual(response.status_code, 200)
-
- @mock.patch("gn3.api.datasets.get_traits_data")
- @mock.patch("gn3.api.datasets.database_connector")
- def test_fetch_traits_data(self, mock_db, mock_get_trait_data):
- """Test api/dataset/fetch_traits_data/d_name/d_type"""
-
- mock_get_trait_data.return_value = {}
- mock_db.return_value = (mock.Mock(), mock.Mock())
- response = self.app.get(
- "/api/dataset/fetch_traits_data/Aging-Brain-UCIPublish/Publish", follow_redirects=True)
-
- self.assertEqual(response.status_code, 200)
- self.assertEqual(response.get_json(), {"results": {}})
diff --git a/tests/integration/test_traits.py b/tests/integration/test_traits.py
deleted file mode 100644
index 410ba22..0000000
--- a/tests/integration/test_traits.py
+++ /dev/null
@@ -1,72 +0,0 @@
-"""module contains integration tests for trait endpoints"""
-from unittest import TestCase
-from unittest import mock
-
-from gn3.app import create_app
-
-
-class TraitIntegrationTest(TestCase):
- """class contains integration tests for\
- traits"""
-
- def setUp(self):
- self.app = create_app().test_client()
-
- @mock.patch("gn3.api.traits.fetch_trait")
- @mock.patch("gn3.api.traits.database_connector")
- def test_create_trait(self, mock_database, mock_fetch_trait):
- """test the endpoint for creating traits\
- endpoint requires trait name and dataset name"""
- mock_database.return_value = (mock.Mock(), mock.Mock())
- trait_results = {
- "dataset": None,
- "trait_name": "1449593_at",
- "trait_data": {
- "BXD11": 8.464,
- "BXD12": 8.414,
- "BXD13": 8.753,
- "BXD15": 8.5,
- "BXD16": 8.832
- }
-
- }
- mock_fetch_trait.return_value = trait_results
-
- results = self.app.get(
- "/api/trait/1449593_at/HC_M2_0606_P", follow_redirects=True)
-
- trait_data = results.get_json()
-
- self.assertEqual(mock_database.call_count, 1)
- self.assertEqual(results.status_code, 200)
- self.assertEqual(trait_data, trait_results)
-
- @mock.patch("gn3.api.traits.get_trait_info_data")
- def test_retrieve_trait_info(self, mock_get_trait_info):
- """integration test for endpoints for retrieving\
- trait info expects the dataset of trait to have been
- created"""
-
- trait_post_data = {
- "trait": {"trait_name": ""},
- "trait_dataset": {"dataset_name": ""}
- }
-
- expected_api_results = {
- "description": "trait description",
- "chr": "",
- "locus": "",
- "mb": "",
- "abbreviation": "trait_abbreviation",
- "trait_display_name": "trait_name"
-
- }
- mock_get_trait_info.return_value = expected_api_results
-
- trait_info = self.app.post(
- "/api/trait/trait_info/144_at", json=trait_post_data, follow_redirects=True)
-
- trait_info_results = trait_info.get_json()
-
- self.assertEqual(trait_info.status_code, 200)
- self.assertEqual(trait_info_results, expected_api_results)