aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/base/test_data_set.py
diff options
context:
space:
mode:
authorBonfaceKilz2020-07-27 14:32:26 +0300
committerBonfaceKilz2020-07-27 14:32:26 +0300
commit5cad720187b3c53b6d64c64d45be4bc020eed52d (patch)
tree9917c77dc38c41ac543404fcd83e4a352afa3065 /wqflask/tests/base/test_data_set.py
parentd63e7554d6dfce4e80c2570667a0fa371235beb7 (diff)
downloadgenenetwork2-5cad720187b3c53b6d64c64d45be4bc020eed52d.tar.gz
Add test case for empty redis instance for DatasetType
* wqflask/tests/base/test_data_set.py(tests): Check correct results are returned when Redis is empty * wqflask/tests/base/data.py(tests): New file. Adds json test data.
Diffstat (limited to 'wqflask/tests/base/test_data_set.py')
-rw-r--r--wqflask/tests/base/test_data_set.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/wqflask/tests/base/test_data_set.py b/wqflask/tests/base/test_data_set.py
index 74799e49..835d786a 100644
--- a/wqflask/tests/base/test_data_set.py
+++ b/wqflask/tests/base/test_data_set.py
@@ -4,7 +4,7 @@ import unittest
import mock
from wqflask import app
-
+from data import gen_menu_json
from base.data_set import DatasetType
@@ -43,3 +43,17 @@ class TestDataSetTypes(unittest.TestCase):
self.assertEqual(DatasetType(redis_mock)
("All Phenotypes"), "Publish")
+ @mock.patch('base.data_set.requests.get')
+ def test_data_set_type_with_empty_redis(self, request_mock):
+ """Test that DatasetType returns correctly if the Redis Instance is empty and
+ the name variable exists in the dictionary
+
+ """
+ with app.app_context():
+ request_mock.return_value.content = gen_menu_json
+ redis_mock = mock.Mock()
+ redis_mock.get.return_value = None
+ data_set = DatasetType(redis_mock)
+ self.assertEqual(data_set("BXDGeno"), "Geno")
+ self.assertEqual(data_set("BXDPublish"), "Publish")
+ self.assertEqual(data_set("HLC_0311"), "ProbeSet")