about summary refs log tree commit diff
path: root/gn2/tests/unit/wqflask/api
diff options
context:
space:
mode:
authorArun Isaac2023-12-30 05:17:17 +0000
committerArun Isaac2023-12-30 05:17:17 +0000
commit8536431f9c367c55d2ea138ab24b2d12e98f7c81 (patch)
tree1d7d272066ee675065e4d1e89fa37fdb5293e101 /gn2/tests/unit/wqflask/api
parent21d6de22641cb1b540e03cb963d12593dab16046 (diff)
downloadgenenetwork2-8536431f9c367c55d2ea138ab24b2d12e98f7c81.tar.gz
Namespace mock paths under gn2.
Diffstat (limited to 'gn2/tests/unit/wqflask/api')
-rw-r--r--gn2/tests/unit/wqflask/api/test_correlation.py10
-rw-r--r--gn2/tests/unit/wqflask/api/test_gen_menu.py32
-rw-r--r--gn2/tests/unit/wqflask/api/test_mapping.py12
-rw-r--r--gn2/tests/unit/wqflask/api/test_markdown_routes.py4
4 files changed, 29 insertions, 29 deletions
diff --git a/gn2/tests/unit/wqflask/api/test_correlation.py b/gn2/tests/unit/wqflask/api/test_correlation.py
index 8835375d..2a1907af 100644
--- a/gn2/tests/unit/wqflask/api/test_correlation.py
+++ b/gn2/tests/unit/wqflask/api/test_correlation.py
@@ -39,7 +39,7 @@ class TestCorrelations(unittest.TestCase):
 
         self.assertEqual(corr_params_results, expected_results)
 
-    @mock.patch("wqflask.api.correlation.database_connection")
+    @mock.patch("gn2.wqflask.api.correlation.database_connection")
     def test_convert_to_mouse_gene_id(self, mock_db):
         conn = mock.MagicMock()
         mock_db.return_value.__enter__.return_value = conn
@@ -59,8 +59,8 @@ class TestCorrelations(unittest.TestCase):
                 convert_to_mouse_gene_id(species="human", gene_id="H1"), "MG-2"
             )
 
-    @mock.patch("wqflask.api.correlation.database_connection")
-    @mock.patch("wqflask.api.correlation.convert_to_mouse_gene_id")
+    @mock.patch("gn2.wqflask.api.correlation.database_connection")
+    @mock.patch("gn2.wqflask.api.correlation.convert_to_mouse_gene_id")
     def test_do_literature_correlation_for_all_traits(
         self, mock_convert_to_mouse_geneid, mock_db
     ):
@@ -88,7 +88,7 @@ class TestCorrelations(unittest.TestCase):
             }
             self.assertEqual(results, expected_results)
 
-    @mock.patch("wqflask.api.correlation.corr_result_helpers.normalize_values")
+    @mock.patch("gn2.wqflask.api.correlation.corr_result_helpers.normalize_values")
     def test_get_sample_r_and_p_values(self, mock_normalize):
 
         group = AttributeSetter(
@@ -146,7 +146,7 @@ class TestCorrelations(unittest.TestCase):
             self.assertAlmostEqual(val, results_spearmanr[i], 4)
         self.assertEqual(results_num_overlap, None)
 
-    @mock.patch("wqflask.api.correlation.do_literature_correlation_for_all_traits")
+    @mock.patch("gn2.wqflask.api.correlation.do_literature_correlation_for_all_traits")
     def test_calculate_results(self, literature_correlation):
 
         literature_correlation.return_value = {
diff --git a/gn2/tests/unit/wqflask/api/test_gen_menu.py b/gn2/tests/unit/wqflask/api/test_gen_menu.py
index a6081e99..2416b3f6 100644
--- a/gn2/tests/unit/wqflask/api/test_gen_menu.py
+++ b/gn2/tests/unit/wqflask/api/test_gen_menu.py
@@ -258,7 +258,7 @@ class TestGenMenu(unittest.TestCase):
                 "ORDER BY -ProbeSetFreeze.OrderList DESC, "
                 "ProbeSetFreeze.CreateTime DESC")
 
-    @mock.patch('wqflask.api.gen_menu.build_datasets')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_datasets')
     def test_build_types(self, datasets_mock):
         """Test that correct tissue metadata is returned"""
         db_mock = mock.MagicMock()
@@ -286,9 +286,9 @@ class TestGenMenu(unittest.TestCase):
                 "ORDER BY Tissue.Name"
             )
 
-    @mock.patch('wqflask.api.gen_menu.build_types')
-    @mock.patch('wqflask.api.gen_menu.genotypes_exist')
-    @mock.patch('wqflask.api.gen_menu.phenotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_types')
+    @mock.patch('gn2.wqflask.api.gen_menu.genotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.phenotypes_exist')
     def test_get_types_with_existing_genotype_and_phenotypes(
             self,
             phenotypes_exist_mock,
@@ -310,9 +310,9 @@ class TestGenMenu(unittest.TestCase):
                                    mock.MagicMock()),
                          expected_result)
 
-    @mock.patch('wqflask.api.gen_menu.build_types')
-    @mock.patch('wqflask.api.gen_menu.genotypes_exist')
-    @mock.patch('wqflask.api.gen_menu.phenotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_types')
+    @mock.patch('gn2.wqflask.api.gen_menu.genotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.phenotypes_exist')
     def test_get_types_with_buildtype_and_non_existent_genotype_and_phenotypes(
             self,
             phenotypes_exist_mock,
@@ -329,9 +329,9 @@ class TestGenMenu(unittest.TestCase):
         self.assertEqual(get_types(self.test_group, mock.MagicMock()),
                          {'mouse': {}, 'human': {}})
 
-    @mock.patch('wqflask.api.gen_menu.build_types')
-    @mock.patch('wqflask.api.gen_menu.genotypes_exist')
-    @mock.patch('wqflask.api.gen_menu.phenotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_types')
+    @mock.patch('gn2.wqflask.api.gen_menu.genotypes_exist')
+    @mock.patch('gn2.wqflask.api.gen_menu.phenotypes_exist')
     def test_get_types_with_non_existent_genotype_phenotypes_and_buildtype(
             self,
             phenotypes_exist_mock,
@@ -357,7 +357,7 @@ class TestGenMenu(unittest.TestCase):
         self.assertEqual(get_types(self.test_group, mock.MagicMock()),
                          expected_result)
 
-    @mock.patch('wqflask.api.gen_menu.build_datasets')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_datasets')
     def test_get_datasets_with_existent_datasets(self,
                                                  build_datasets_mock):
         """Test correct dataset is returned with existent build_datasets"""
@@ -379,7 +379,7 @@ class TestGenMenu(unittest.TestCase):
         self.assertEqual(get_datasets(self.test_type, mock.MagicMock()),
                          expected_result)
 
-    @mock.patch('wqflask.api.gen_menu.build_datasets')
+    @mock.patch('gn2.wqflask.api.gen_menu.build_datasets')
     def test_get_datasets_with_non_existent_datasets(self,
                                                      build_datasets_mock):
         """Test correct dataset is returned with non-existent build_datasets"""
@@ -393,10 +393,10 @@ class TestGenMenu(unittest.TestCase):
         self.assertEqual(get_datasets(self.test_type, mock.MagicMock()),
                          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_all_species')
+    @mock.patch('gn2.wqflask.api.gen_menu.get_datasets')
+    @mock.patch('gn2.wqflask.api.gen_menu.get_types')
+    @mock.patch('gn2.wqflask.api.gen_menu.get_groups')
+    @mock.patch('gn2.wqflask.api.gen_menu.get_all_species')
     def test_gen_dropdown_json(self,
                                species_mock,
                                groups_mock,
diff --git a/gn2/tests/unit/wqflask/api/test_mapping.py b/gn2/tests/unit/wqflask/api/test_mapping.py
index 1553cbf6..226e2a9b 100644
--- a/gn2/tests/unit/wqflask/api/test_mapping.py
+++ b/gn2/tests/unit/wqflask/api/test_mapping.py
@@ -63,12 +63,12 @@ class TestMapping(unittest.TestCase):
 
         self.assertEqual(results_2, expected_results)
 
-    @mock.patch("wqflask.api.mapping.rqtl_mapping.run_rqtl")
-    @mock.patch("wqflask.api.mapping.gemma_mapping.run_gemma")
-    @mock.patch("wqflask.api.mapping.initialize_parameters")
-    @mock.patch("wqflask.api.mapping.retrieve_sample_data")
-    @mock.patch("wqflask.api.mapping.create_trait")
-    @mock.patch("wqflask.api.mapping.data_set.create_dataset")
+    @mock.patch("gn2.wqflask.api.mapping.rqtl_mapping.run_rqtl")
+    @mock.patch("gn2.wqflask.api.mapping.gemma_mapping.run_gemma")
+    @mock.patch("gn2.wqflask.api.mapping.initialize_parameters")
+    @mock.patch("gn2.wqflask.api.mapping.retrieve_sample_data")
+    @mock.patch("gn2.wqflask.api.mapping.create_trait")
+    @mock.patch("gn2.wqflask.api.mapping.data_set.create_dataset")
     def test_do_mapping_for_api(self, mock_create_dataset, mock_trait, mock_retrieve_sample, mock_param, run_gemma, run_rqtl_geno):
         start_vars = {
             "db": "Temp",
diff --git a/gn2/tests/unit/wqflask/api/test_markdown_routes.py b/gn2/tests/unit/wqflask/api/test_markdown_routes.py
index f0f93bc1..ecf64a81 100644
--- a/gn2/tests/unit/wqflask/api/test_markdown_routes.py
+++ b/gn2/tests/unit/wqflask/api/test_markdown_routes.py
@@ -26,7 +26,7 @@ This is another sub-heading"""
 class TestMarkdownRoutesFunctions(unittest.TestCase):
     """Test cases for functions in markdown"""
 
-    @mock.patch('wqflask.api.markdown.requests.get')
+    @mock.patch('gn2.wqflask.api.markdown.requests.get')
     def test_render_markdown_when_fetching_locally(self, requests_mock):
         requests_mock.return_value = MockRequests404()
         markdown_content = render_markdown("general/glossary/glossary.md")
@@ -38,7 +38,7 @@ class TestMarkdownRoutesFunctions(unittest.TestCase):
         self.assertRegex(markdown_content,
                          "Content for general/glossary/glossary.md not available.")
 
-    @mock.patch('wqflask.api.markdown.requests.get')
+    @mock.patch('gn2.wqflask.api.markdown.requests.get')
     def test_render_markdown_when_fetching_remotely(self, requests_mock):
         requests_mock.return_value = MockRequests200()
         markdown_content = render_markdown("general/glossary/glossary.md")