aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests
diff options
context:
space:
mode:
authorAlexanderlacuna2020-11-09 17:22:27 +0300
committerAlexanderlacuna2020-11-09 17:22:27 +0300
commite660984015e1bc6d48e9ccee5fe59691c4acd911 (patch)
tree4b243877951557bffa8f0422705811dfbff4b8fe /wqflask/tests
parent986b20363cc84be1822588dd7cc935fca7ef7f48 (diff)
downloadgenenetwork2-e660984015e1bc6d48e9ccee5fe59691c4acd911.tar.gz
add tests for geno_db_exists in marker_regression/run_mapping.py
Diffstat (limited to 'wqflask/tests')
-rw-r--r--wqflask/tests/wqflask/marker_regression/test_run_mapping.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/wqflask/tests/wqflask/marker_regression/test_run_mapping.py b/wqflask/tests/wqflask/marker_regression/test_run_mapping.py
index 0a5bc565..61bc8a1d 100644
--- a/wqflask/tests/wqflask/marker_regression/test_run_mapping.py
+++ b/wqflask/tests/wqflask/marker_regression/test_run_mapping.py
@@ -1,7 +1,7 @@
import unittest
from unittest import mock
from wqflask.marker_regression.run_mapping import get_genofile_samplelist
-
+from wqflask.marker_regression.run_mapping import geno_db_exists
class AttributeSetter:
def __init__(self,obj):
@@ -15,7 +15,7 @@ class MockDataSetGroup(AttributeSetter):
return [{"location":"~/genofiles/g1_file","sample_list":["S1","S2","S3","S4"]}]
class TestRunMapping(unittest.TestCase):
def setUp(self):
- self.group=MockDataSetGroup({"genofile":"~/genofiles/g1_file"})
+ self.group=MockDataSetGroup({"genofile":"~/genofiles/g1_file","name":"GP1_"})
self.dataset=AttributeSetter({"group":self.group})
def tearDown(self):
@@ -32,5 +32,21 @@ class TestRunMapping(unittest.TestCase):
result_2=get_genofile_samplelist(self.dataset)
self.assertEqual(result_2,[])
+ @mock.patch("wqflask.marker_regression.run_mapping.data_set")
+ def test_geno_db_exists(self,mock_data_set):
+ # mock_data_set.create_dataset_side_effect=None
+ mock_data_set.create_dataset.side_effect=[AttributeSetter({}),Exception()]
+ results_no_error=geno_db_exists(self.dataset)
+ results_with_error=geno_db_exists(self.dataset)
+
+ self.assertEqual(mock_data_set.create_dataset.call_count,2)
+ self.assertEqual(results_with_error,"False")
+ self.assertEqual(results_no_error,"True")
+
+
+
+
+
+