aboutsummaryrefslogtreecommitdiff
path: root/gn2/tests/unit/wqflask
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
parent21d6de22641cb1b540e03cb963d12593dab16046 (diff)
downloadgenenetwork2-8536431f9c367c55d2ea138ab24b2d12e98f7c81.tar.gz
Namespace mock paths under gn2.
Diffstat (limited to 'gn2/tests/unit/wqflask')
-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
-rw-r--r--gn2/tests/unit/wqflask/correlation/test_correlation_functions.py2
-rw-r--r--gn2/tests/unit/wqflask/marker_regression/test_gemma_mapping.py40
-rw-r--r--gn2/tests/unit/wqflask/marker_regression/test_plink_mapping.py10
-rw-r--r--gn2/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py2
-rw-r--r--gn2/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py6
-rw-r--r--gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py6
-rw-r--r--gn2/tests/unit/wqflask/show_trait/test_export_trait_data.py6
-rw-r--r--gn2/tests/unit/wqflask/snp_browser/test_snp_browser.py8
-rw-r--r--gn2/tests/unit/wqflask/test_collect.py4
-rw-r--r--gn2/tests/unit/wqflask/test_resource_manager.py4
14 files changed, 73 insertions, 73 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")
diff --git a/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py b/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py
index c0f57141..f76ef57e 100644
--- a/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py
+++ b/gn2/tests/unit/wqflask/correlation/test_correlation_functions.py
@@ -11,7 +11,7 @@ def test_tissue_corr_computation(mocker):
"""Test for cal_zero_order_corr_for_tiss"""
primary_values = [9.288, 9.313, 8.988, 9.660, 8.21]
target_values = [9.586, 8.498, 9.362, 8.820, 8.786]
- _m = mocker.patch(("wqflask.correlation.correlation_functions."
+ _m = mocker.patch(("gn2.wqflask.correlation.correlation_functions."
"compute_corr_coeff_p_value"),
return_value=(0.51, 0.7))
results = cal_zero_order_corr_for_tiss(primary_values, target_values)
diff --git a/gn2/tests/unit/wqflask/marker_regression/test_gemma_mapping.py b/gn2/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
index 26f0c50a..b4d80ad7 100644
--- a/gn2/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
+++ b/gn2/tests/unit/wqflask/marker_regression/test_gemma_mapping.py
@@ -22,7 +22,7 @@ class MockGroup(AttributeSetter):
class TestGemmaMapping(unittest.TestCase):
- @mock.patch("wqflask.marker_regression.gemma_mapping.parse_loco_output")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.parse_loco_output")
def test_run_gemma_firstrun_set_false(self, mock_parse_loco):
"""add tests for gemma function where first run is set to false"""
dataset = AttributeSetter(
@@ -38,17 +38,17 @@ class TestGemmaMapping(unittest.TestCase):
expected_results = ([], "file1")
self.assertEqual(expected_results, result)
- @mock.patch("wqflask.marker_regression.gemma_mapping.webqtlConfig.GENERATED_IMAGE_DIR", "/home/user/img")
- @mock.patch("wqflask.marker_regression.gemma_mapping.GEMMAOPTS", "-debug")
- @mock.patch("wqflask.marker_regression.gemma_mapping.GEMMA_WRAPPER_COMMAND", "ghc")
- @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR",
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.webqtlConfig.GENERATED_IMAGE_DIR", "/home/user/img")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.GEMMAOPTS", "-debug")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.GEMMA_WRAPPER_COMMAND", "ghc")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.TEMPDIR",
os.path.join(os.path.dirname(__file__), "user/data"))
- @mock.patch("wqflask.marker_regression.gemma_mapping.parse_loco_output")
- @mock.patch("wqflask.marker_regression.gemma_mapping.flat_files")
- @mock.patch("wqflask.marker_regression.gemma_mapping.gen_covariates_file")
- @mock.patch("wqflask.marker_regression.run_mapping.random.choice")
- @mock.patch("wqflask.marker_regression.gemma_mapping.os")
- @mock.patch("wqflask.marker_regression.gemma_mapping.gen_pheno_txt_file")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.parse_loco_output")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.flat_files")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.gen_covariates_file")
+ @mock.patch("gn2.wqflask.marker_regression.run_mapping.random.choice")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.os")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.gen_pheno_txt_file")
def test_run_gemma_firstrun_set_true(self, mock_gen_pheno_txt, mock_os, mock_choice, mock_gen_covar, mock_flat_files, mock_parse_loco):
"""add tests for run_gemma where first run is set to true"""
this_chromosomes = {}
@@ -78,7 +78,7 @@ class TestGemmaMapping(unittest.TestCase):
('/home/user/imgfile_output.assoc.txt'))
self.assertEqual(results, ([], "GP1_GWA_RRRRRR"))
- @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/user/data")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/user/data")
def test_gen_pheno_txt_file(self):
"""add tests for generating pheno txt file"""
with mock.patch("builtins.open", mock.mock_open())as mock_open:
@@ -95,9 +95,9 @@ class TestGemmaMapping(unittest.TestCase):
filehandler.write.assert_has_calls(write_calls)
- @mock.patch("wqflask.marker_regression.gemma_mapping.flat_files")
- @mock.patch("wqflask.marker_regression.gemma_mapping.create_trait")
- @mock.patch("wqflask.marker_regression.gemma_mapping.create_dataset")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.flat_files")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.create_trait")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.create_dataset")
def test_gen_covariates_file(self, create_dataset, create_trait, flat_files):
"""add tests for generating covariates files"""
covariates = "X1:X2,Y1:Y2,M1:M3,V1:V2"
@@ -140,9 +140,9 @@ class TestGemmaMapping(unittest.TestCase):
filehandler.write.assert_has_calls([mock.call(
'-9\t'), mock.call('-9\t'), mock.call('-9\t'), mock.call('-9\t'), mock.call('\n')])
- @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/tmp")
- @mock.patch("wqflask.marker_regression.gemma_mapping.os")
- @mock.patch("wqflask.marker_regression.gemma_mapping.json")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/tmp")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.os")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.json")
def test_parse_loco_outputfile_found(self, mock_json, mock_os):
"""add tests for parse loco output file found"""
mock_json.load.return_value = {
@@ -174,8 +174,8 @@ X\tM5\t12\tQ\tE\tMMB\tR\t21.1\tW\t0.65\t0.6"""
{'name': 'M5', 'chr': 'X', 'Mb': 1.2e-05, 'p_value': 0.6, 'additive': -10.55, 'lod_score': 0.22184874961635637}]
self.assertEqual(expected_results, results)
- @mock.patch("wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/tmp")
- @mock.patch("wqflask.marker_regression.gemma_mapping.os")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.TEMPDIR", "/home/tmp")
+ @mock.patch("gn2.wqflask.marker_regression.gemma_mapping.os")
def test_parse_loco_outputfile_not_found(self, mock_os):
"""add tests for parse loco output where output file not found"""
diff --git a/gn2/tests/unit/wqflask/marker_regression/test_plink_mapping.py b/gn2/tests/unit/wqflask/marker_regression/test_plink_mapping.py
index 4c13b907..7542e15a 100644
--- a/gn2/tests/unit/wqflask/marker_regression/test_plink_mapping.py
+++ b/gn2/tests/unit/wqflask/marker_regression/test_plink_mapping.py
@@ -27,7 +27,7 @@ class TestPlinkMapping(unittest.TestCase):
self.assertEqual([], build_line_list())
self.assertEqual(["this", "is", "an,", "irregular", "line"], results)
- @mock.patch("wqflask.marker_regression.plink_mapping.flat_files")
+ @mock.patch("gn2.wqflask.marker_regression.plink_mapping.flat_files")
def test_get_samples_from_ped_file(self, mock_flat_files):
"""test for getting samples from ped file"""
dataset = AttributeSetter({"group": AttributeSetter({"name": "n_1"})})
@@ -42,8 +42,8 @@ Expected_2\there
self.assertEqual(
["Expected_1", "Expected_2", "Expected_3"], results)
- @mock.patch("wqflask.marker_regression.plink_mapping.TMPDIR", "/home/user/data/")
- @mock.patch("wqflask.marker_regression.plink_mapping.get_samples_from_ped_file")
+ @mock.patch("gn2.wqflask.marker_regression.plink_mapping.TMPDIR", "/home/user/data/")
+ @mock.patch("gn2.wqflask.marker_regression.plink_mapping.get_samples_from_ped_file")
def test_gen_pheno_txt_file_plink(self, mock_samples):
"""test for getting gen_pheno txt file"""
mock_samples.return_value = ["Expected_1", "Expected_2", "Expected_3"]
@@ -64,8 +64,8 @@ Expected_2\there
filehandler.close.assert_called_once()
- @mock.patch("wqflask.marker_regression.plink_mapping.TMPDIR", "/home/user/data/")
- @mock.patch("wqflask.marker_regression.plink_mapping.build_line_list")
+ @mock.patch("gn2.wqflask.marker_regression.plink_mapping.TMPDIR", "/home/user/data/")
+ @mock.patch("gn2.wqflask.marker_regression.plink_mapping.build_line_list")
def test_parse_plink_output(self, mock_line_list):
"""test for parsing plink output"""
chromosomes = [0, 34, 110, 89, 123, 23, 2]
diff --git a/gn2/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py b/gn2/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
index 2268f4cb..c2753141 100644
--- a/gn2/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
+++ b/gn2/tests/unit/wqflask/marker_regression/test_qtlreaper_mapping.py
@@ -7,7 +7,7 @@ from gn2.wqflask.marker_regression.qtlreaper_mapping import gen_pheno_txt_file
class TestQtlReaperMapping(unittest.TestCase):
- @mock.patch("wqflask.marker_regression.qtlreaper_mapping.TEMPDIR", "/home/user/data")
+ @mock.patch("gn2.wqflask.marker_regression.qtlreaper_mapping.TEMPDIR", "/home/user/data")
def test_gen_pheno_txt_file(self):
vals = ["V1", "x", "V4", "V3", "x"]
samples = ["S1", "S2", "S3", "S4", "S5"]
diff --git a/gn2/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py b/gn2/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
index 5cfce28c..9f646fb0 100644
--- a/gn2/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
+++ b/gn2/tests/unit/wqflask/marker_regression/test_rqtl_mapping.py
@@ -15,9 +15,9 @@ class MockDataset:
class TestRqtlMapping(unittest.TestCase):
"""Tests for functions in rqtl_mapping.py"""
- @mock.patch("wqflask.marker_regression.rqtl_mapping.requests.post")
- @mock.patch("wqflask.marker_regression.rqtl_mapping.locate")
- @mock.patch("wqflask.marker_regression.rqtl_mapping.write_phenotype_file")
+ @mock.patch("gn2.wqflask.marker_regression.rqtl_mapping.requests.post")
+ @mock.patch("gn2.wqflask.marker_regression.rqtl_mapping.locate")
+ @mock.patch("gn2.wqflask.marker_regression.rqtl_mapping.write_phenotype_file")
def test_run_rqtl_with_perm(self, mock_write_pheno_file, mock_locate, mock_post):
"""Test for run_rqtl with permutations > 0"""
dataset_group = MockGroup("GP1", "file_geno")
diff --git a/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py b/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py
index dd67ce49..817bf2b9 100644
--- a/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py
+++ b/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py
@@ -61,7 +61,7 @@ class TestRunMapping(unittest.TestCase):
result_2 = get_genofile_samplelist(self.dataset)
self.assertEqual(result_2, [])
- @mock.patch("wqflask.marker_regression.run_mapping.data_set")
+ @mock.patch("gn2.wqflask.marker_regression.run_mapping.data_set")
def test_if_geno_db_exists(self, mock_data_set):
mock_data_set.create_dataset.side_effect = [
AttributeSetter({}), Exception()]
@@ -178,7 +178,7 @@ class TestRunMapping(unittest.TestCase):
with mock.patch("builtins.open", mock.mock_open()) as mock_open:
- with mock.patch("wqflask.marker_regression.run_mapping.datetime.datetime", new=datetime_mock):
+ with mock.patch("gn2.wqflask.marker_regression.run_mapping.datetime.datetime", new=datetime_mock):
export_mapping_results(dataset=self.dataset, trait=self.trait, markers=markers,
results_path="~/results", mapping_method="gemma", mapping_scale="physic",
score_type="-logP", transform="qnorm",
@@ -215,7 +215,7 @@ class TestRunMapping(unittest.TestCase):
filehandler = mock_open()
filehandler.write.assert_has_calls(write_calls)
- @mock.patch("wqflask.marker_regression.run_mapping.random.choice")
+ @mock.patch("gn2.wqflask.marker_regression.run_mapping.random.choice")
def test_write_input_for_browser(self, mock_choice):
"""test for writing input for browser"""
mock_choice.side_effect = ["F", "i", "l", "e", "s", "x"]
diff --git a/gn2/tests/unit/wqflask/show_trait/test_export_trait_data.py b/gn2/tests/unit/wqflask/show_trait/test_export_trait_data.py
index a933d0bf..1ecf394b 100644
--- a/gn2/tests/unit/wqflask/show_trait/test_export_trait_data.py
+++ b/gn2/tests/unit/wqflask/show_trait/test_export_trait_data.py
@@ -16,9 +16,9 @@ class AttributesSetter:
class TestExportTraits(unittest.TestCase):
"""Test methods for exporting traits and metadata"""
- @mock.patch("wqflask.show_trait.export_trait_data.datetime")
- @mock.patch("wqflask.show_trait.export_trait_data.create_trait")
- @mock.patch("wqflask.show_trait.export_trait_data.data_set")
+ @mock.patch("gn2.wqflask.show_trait.export_trait_data.datetime")
+ @mock.patch("gn2.wqflask.show_trait.export_trait_data.create_trait")
+ @mock.patch("gn2.wqflask.show_trait.export_trait_data.data_set")
def test_get_export_metadata(self, data_mock, trait_mock, date_mock):
"""test for exporting metadata with dataset.type=Publish"""
mock_dataset = AttributesSetter({"type": "Publish",
diff --git a/gn2/tests/unit/wqflask/snp_browser/test_snp_browser.py b/gn2/tests/unit/wqflask/snp_browser/test_snp_browser.py
index c33f46ef..bf0421c0 100644
--- a/gn2/tests/unit/wqflask/snp_browser/test_snp_browser.py
+++ b/gn2/tests/unit/wqflask/snp_browser/test_snp_browser.py
@@ -102,7 +102,7 @@ class TestSnpBrowser(unittest.TestCase):
self.assertEqual(expected_results, results_with_snp)
self.assertEqual(expected_results_with_indel, results_with_indel)
- @mock.patch("wqflask.snp_browser.snp_browser.database_connection")
+ @mock.patch("gn2.wqflask.snp_browser.snp_browser.database_connection")
def test_get_gene_id(self, mock_db):
db_query_value = (
"SELECT geneId FROM GeneList WHERE " "SpeciesId = %s AND geneSymbol = %s"
@@ -122,7 +122,7 @@ class TestSnpBrowser(unittest.TestCase):
)
self.assertEqual(results, "517d729f-aa13-4413-a885-40a3f7ff768a")
- @mock.patch("wqflask.snp_browser.snp_browser.database_connection")
+ @mock.patch("gn2.wqflask.snp_browser.snp_browser.database_connection")
def test_gene_id_name_dict(self, mock_db):
no_gene_names = []
conn = mock.MagicMock()
@@ -164,7 +164,7 @@ class TestSnpBrowser(unittest.TestCase):
self.assertEqual(results_found, expected_found)
self.assertEqual(no_results, {})
- @mock.patch("wqflask.snp_browser.snp_browser.database_connection")
+ @mock.patch("gn2.wqflask.snp_browser.snp_browser.database_connection")
def test_check_if_in_gene(self, mock_db):
conn = mock.MagicMock()
mock_db.return_value.__enter__.return_value = conn
@@ -196,7 +196,7 @@ class TestSnpBrowser(unittest.TestCase):
)
self.assertEqual(gene_not_found, "")
- @mock.patch("wqflask.snp_browser.snp_browser.database_connection")
+ @mock.patch("gn2.wqflask.snp_browser.snp_browser.database_connection")
def test_get_browser_sample_lists(self, mock_db):
conn = mock.MagicMock()
mock_db.return_value.__enter__.return_value = conn
diff --git a/gn2/tests/unit/wqflask/test_collect.py b/gn2/tests/unit/wqflask/test_collect.py
index 41d6bf74..6c1bafa5 100644
--- a/gn2/tests/unit/wqflask/test_collect.py
+++ b/gn2/tests/unit/wqflask/test_collect.py
@@ -42,7 +42,7 @@ class TestCollect(unittest.TestCase):
def tearDown(self):
self.app_context.pop()
- @mock.patch("wqflask.collect.g", MockFlaskG())
+ @mock.patch("gn2.wqflask.collect.g", MockFlaskG())
def test_process_traits_with_bytestring(self):
"""
Test that the correct traits are returned when the user is logged
@@ -58,7 +58,7 @@ class TestCollect(unittest.TestCase):
'1452447_at:HC_M2_0606_P',
'1452452_at:HC_M2_0606_P']))
- @mock.patch("wqflask.collect.g", MockFlaskG())
+ @mock.patch("gn2.wqflask.collect.g", MockFlaskG())
def test_process_traits_with_normal_string(self):
"""
Test that the correct traits are returned when the user is logged
diff --git a/gn2/tests/unit/wqflask/test_resource_manager.py b/gn2/tests/unit/wqflask/test_resource_manager.py
index f4335425..a4b3a0ee 100644
--- a/gn2/tests/unit/wqflask/test_resource_manager.py
+++ b/gn2/tests/unit/wqflask/test_resource_manager.py
@@ -58,7 +58,7 @@ class TestGetUserMembership(unittest.TestCase):
class TestCheckUserAccessRole(unittest.TestCase):
"""Test cases for `get_highest_user_access_role`"""
- @mock.patch("wqflask.resource_manager.requests.get")
+ @mock.patch("gn2.wqflask.resource_manager.requests.get")
def test_edit_access(self, requests_mock):
"""Test that the right access roles are set"""
response = mock.PropertyMock(return_value=json.dumps(
@@ -76,7 +76,7 @@ class TestCheckUserAccessRole(unittest.TestCase):
"metadata": DataRole.EDIT,
"admin": AdminRole.EDIT_ACCESS})
- @mock.patch("wqflask.resource_manager.requests.get")
+ @mock.patch("gn2.wqflask.resource_manager.requests.get")
def test_no_access(self, requests_mock):
response = mock.PropertyMock(return_value=json.dumps(
{