diff options
author | BonfaceKilz | 2020-08-03 16:07:08 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-08-03 16:44:49 +0300 |
commit | 452f5442fec13afce07997494adc46fb4bbee9d7 (patch) | |
tree | 4ce884be4579f752e08e653fd11b73131fa7b6fe /wqflask/tests/api/test_gen_menu.py | |
parent | 899cf35a1dce7ad18645d00238fb39917f8e6e4f (diff) | |
download | genenetwork2-452f5442fec13afce07997494adc46fb4bbee9d7.tar.gz |
Add test for "gen_dropdown_json"
* wqflask/tests/api/test_gen_menu.py: Add new test
Diffstat (limited to 'wqflask/tests/api/test_gen_menu.py')
-rw-r--r-- | wqflask/tests/api/test_gen_menu.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/wqflask/tests/api/test_gen_menu.py b/wqflask/tests/api/test_gen_menu.py index a606a300..92485d38 100644 --- a/wqflask/tests/api/test_gen_menu.py +++ b/wqflask/tests/api/test_gen_menu.py @@ -2,6 +2,7 @@ import unittest import mock +from wqflask.api.gen_menu import gen_dropdown_json from wqflask.api.gen_menu import get_species from wqflask.api.gen_menu import get_groups from wqflask.api.gen_menu import get_types @@ -383,3 +384,31 @@ class TestGenMenu(unittest.TestCase): self.assertEqual(get_datasets(self.test_type), expected_result) + @mock.patch('wqflask.api.gen_menu.get_datasets') + @mock.patch('wqflask.api.gen_menu.get_types') + @mock.patch('wqflask.api.gen_menu.get_groups') + @mock.patch('wqflask.api.gen_menu.get_species') + def test_gen_dropdown_json(self, + species_mock, + groups_mock, + types_mock, + datasets_mock): + "Test that the correct dictionary is constructed properly" + species_mock.return_value = ("speciesA speciesB speciesC speciesD" + .split(" ")) + datasets_mock.return_value = ("datasetA datasetB datasetC datasetD" + .split(" ")) + groups_mock.return_value = ("groupA groupB groupC groupD" + .split(" ")) + types_mock.return_value = ("typeA typeB typeC typeD" + .split(" ")) + datasets_mock.return_value = ("datasetA datasetB datasetC datasetD" + .split(" ")) + + expected_result = { + 'datasets': ['datasetA', 'datasetB', 'datasetC', 'datasetD'], + 'types': ['typeA', 'typeB', 'typeC', 'typeD'], + 'groups': ['groupA', 'groupB', 'groupC', 'groupD'], + 'species': ['speciesA', 'speciesB', 'speciesC', 'speciesD']} + + self.assertEqual(gen_dropdown_json(), expected_result) |