aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests
diff options
context:
space:
mode:
authorBonfaceKilz2020-07-29 22:09:21 +0300
committerBonfaceKilz2020-07-29 22:09:21 +0300
commitb55792f2daf648affe52d78c7f3a480f6550dfc8 (patch)
treeff9a47c02c6b168cd5e8dedd0bc4dd46a9b18af1 /wqflask/tests
parent06a3758eedbc6df53caab3b1ef320df781b71e83 (diff)
downloadgenenetwork2-b55792f2daf648affe52d78c7f3a480f6550dfc8.tar.gz
Add initial gen_menu test
* wqflask/tests/api/__init__.py: Add it * wqflask/tests/api/test_gen_menu.py: Add test for get_species
Diffstat (limited to 'wqflask/tests')
-rw-r--r--wqflask/tests/api/__init__.py0
-rw-r--r--wqflask/tests/api/test_gen_menu.py19
2 files changed, 19 insertions, 0 deletions
diff --git a/wqflask/tests/api/__init__.py b/wqflask/tests/api/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/wqflask/tests/api/__init__.py
diff --git a/wqflask/tests/api/test_gen_menu.py b/wqflask/tests/api/test_gen_menu.py
new file mode 100644
index 00000000..81908129
--- /dev/null
+++ b/wqflask/tests/api/test_gen_menu.py
@@ -0,0 +1,19 @@
+"""Test cases for wqflask.api.gen_menu"""
+import unittest
+import mock
+
+from wqflask.api.gen_menu import get_species
+
+class TestGenMenu(unittest.TestCase):
+ """Tests for the gen_menu module"""
+
+ @mock.patch('wqflask.api.gen_menu.g')
+ def test_get_species(self, db_mock):
+ """Test that assertion is raised when dataset and dataset_name are defined"""
+ db_mock.db.execute.return_value.fetchall.return_value = (('human', 'Human'),
+ ('mouse', 'Mouse'))
+ self.assertEqual(get_species(),
+ [['human', 'Human'], ['mouse', 'Mouse']])
+ db_mock.db.execute.assert_called_once_with(
+ "SELECT Name, MenuName FROM Species ORDER BY OrderId"
+ )