diff options
author | John Nduli | 2024-11-06 17:01:28 +0300 |
---|---|---|
committer | Munyoki Kilyungi | 2024-11-07 09:50:33 +0300 |
commit | 8822a5ce161461a4d15326af4ef90bc574b72048 (patch) | |
tree | 9d5f9182d759e93242fec0bdf36e2a32fa8088af | |
parent | bb98553aea6d217f791f886c1bd2f2570a7477ef (diff) | |
download | genenetwork2-testing.tar.gz |
-rw-r--r-- | gn2/base/trait.py | 10 | ||||
-rw-r--r-- | gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/gn2/base/trait.py b/gn2/base/trait.py index 24288ba1..8375c682 100644 --- a/gn2/base/trait.py +++ b/gn2/base/trait.py @@ -27,15 +27,10 @@ def create_trait(**kw): if bool(kw.get('dataset')): dataset = kw.get('dataset') - - else: if kw.get('dataset_name') != "Temp": - - dataset = create_dataset(kw.get('dataset_name')) else: - dataset = create_dataset( dataset_name="Temp", dataset_type="Temp", @@ -49,9 +44,8 @@ def create_trait(**kw): permissions = check_resource_availability( dataset, g.user_session.user_id) - if permissions['data'] != "no-access": - + the_trait = GeneralTrait(**dict(kw,dataset=dataset)) if the_trait.dataset.type != "Temp": the_trait = retrieve_trait_info( @@ -641,4 +635,4 @@ def fetch_symbols(trait_db_list): 'db_name': trait_db.split(":")[1]}) symbol_list.append(cursor.fetchone()[0]) - return "+".join(symbol_list)
\ No newline at end of file + return "+".join(symbol_list) 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 817bf2b9..569756c3 100644 --- a/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py +++ b/gn2/tests/unit/wqflask/marker_regression/test_run_mapping.py @@ -2,6 +2,7 @@ import unittest import datetime from unittest import mock +import gn2.wqflask.marker_regression.run_mapping as run_mapping from gn2.wqflask.marker_regression.run_mapping import get_genofile_samplelist from gn2.wqflask.marker_regression.run_mapping import geno_db_exists from gn2.wqflask.marker_regression.run_mapping import write_input_for_browser @@ -65,8 +66,9 @@ class TestRunMapping(unittest.TestCase): def test_if_geno_db_exists(self, mock_data_set): 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) + run_mapping.create_trait = mock.Mock() + results_no_error = geno_db_exists(self.dataset, "dataset_1") + results_with_error = geno_db_exists(self.dataset, "dataset_1") self.assertEqual(mock_data_set.create_dataset.call_count, 2) self.assertEqual(results_with_error, "False") |