aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/computations
diff options
context:
space:
mode:
authorAlexander Kabui2021-03-31 23:55:52 +0300
committerAlexander Kabui2021-03-31 23:55:52 +0300
commit9d7839a75f158cb9ca46d81a5384ad42374ddd26 (patch)
treee181b25e8dff39145be3c8ca73ed1d74873e0def /tests/unit/computations
parentf065ea860f8001942bbf7c61eb49e515d358d2eb (diff)
downloadgenenetwork3-9d7839a75f158cb9ca46d81a5384ad42374ddd26.tar.gz
add fetch dataset strain id,strain name and unittests
Diffstat (limited to 'tests/unit/computations')
-rw-r--r--tests/unit/computations/test_datasets.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/unit/computations/test_datasets.py b/tests/unit/computations/test_datasets.py
index 7135041..b169ba3 100644
--- a/tests/unit/computations/test_datasets.py
+++ b/tests/unit/computations/test_datasets.py
@@ -13,6 +13,7 @@ from gn3.computations.datasets import create_dataset
from gn3.computations.datasets import dataset_creator_store
from gn3.computations.datasets import dataset_type_getter
from gn3.computations.datasets import fetch_dataset_type_from_gn2_api
+from gn3.computations.datasets import fetch_dataset_sample_id
class TestDatasets(TestCase):
@@ -157,3 +158,24 @@ class TestDatasets(TestCase):
}
self.assertEqual(expected_results, results)
+
+ def test_fetch_dataset_sample_id(self):
+ """get from the database the sample\
+ id if only in the samplelists"""
+
+ expected_results = {"B6D2F1": 1, "BXD1": 4, "BXD11": 10,
+ "BXD12": 11, "BXD13": 12, "BXD15": 14, "BXD16": 15}
+
+ database_instance = mock.Mock()
+ database_cursor = mock.Mock()
+
+ database_cursor.execute.return_value = 5
+ database_cursor.fetchall.return_value = list(expected_results.items())
+ database_instance.cursor.return_value = database_cursor
+ strain_list = ["B6D2F1", "BXD1", "BXD11",
+ "BXD12", "BXD13", "BXD16", "BXD15"]
+
+ results = fetch_dataset_sample_id(
+ samplelist=strain_list, database=database_instance, species="mouse")
+
+ self.assertEqual(results, expected_results)