aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/api
diff options
context:
space:
mode:
authorBonfaceKilz2020-08-03 16:47:42 +0300
committerBonfaceKilz2020-08-03 17:05:51 +0300
commit77a55f3cfe70dfbe319c28380eb16a4f9516366c (patch)
tree1cdfca2a614b9822328055b7270ca38d29b3e7f2 /wqflask/tests/api
parent30341891c22e2161c1217f808ed05748c91036e2 (diff)
downloadgenenetwork2-77a55f3cfe70dfbe319c28380eb16a4f9516366c.tar.gz
Add extra test for "build_datasets"
* wqflask/tests/api/test_gen_menu.py: Add test.
Diffstat (limited to 'wqflask/tests/api')
-rw-r--r--wqflask/tests/api/test_gen_menu.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/wqflask/tests/api/test_gen_menu.py b/wqflask/tests/api/test_gen_menu.py
index ca841708..4a928d12 100644
--- a/wqflask/tests/api/test_gen_menu.py
+++ b/wqflask/tests/api/test_gen_menu.py
@@ -179,6 +179,25 @@ class TestGenMenu(unittest.TestCase):
[["None", "BXDPublish", "Mouse Phenome Database"]])
@mock.patch('wqflask.api.gen_menu.g')
+ def test_build_datasets_with_type_phenotypes_and_no_results(self, db_mock):
+ """Test that correct dataset is returned for a phenotype type with no
+ results
+
+ """
+ db_mock.db.execute.return_value.fetchall.return_value = None
+ db_mock.db.execute.return_value.fetchone.return_value = (121,
+ "text value")
+ self.assertEqual(build_datasets("Mouse", "BXD", "Phenotypes"),
+ [["None", "121", "text value"]])
+ db_mock.db.execute.assert_called_with(
+ "SELECT PublishFreeze.Name, PublishFreeze.FullName "
+ "FROM PublishFreeze, InbredSet "
+ "WHERE InbredSet.Name = 'BXD' AND "
+ "PublishFreeze.InbredSetId = InbredSet.Id "
+ "ORDER BY PublishFreeze.CreateTime ASC"
+ )
+
+ @mock.patch('wqflask.api.gen_menu.g')
def test_build_datasets_with_type_genotypes(self, db_mock):
"""Test that correct dataset is returned for a phenotype type"""
db_mock.db.execute.return_value.fetchone.return_value = (