diff options
Diffstat (limited to 'tests/unit/db/test_datasets.py')
-rw-r--r-- | tests/unit/db/test_datasets.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/tests/unit/db/test_datasets.py b/tests/unit/db/test_datasets.py index 0b24489..e4abd2f 100644 --- a/tests/unit/db/test_datasets.py +++ b/tests/unit/db/test_datasets.py @@ -15,14 +15,14 @@ class TestDatasetsDBFunctions(TestCase): @pytest.mark.unit_test def test_retrieve_dataset_name(self): """Test that the function is called correctly.""" - for trait_type, thresh, trait_name, dataset_name, columns, table, expected in [ - ["ProbeSet", 9, "probesetTraitName", "probesetDatasetName", + for trait_type, thresh, dataset_name, columns, table, expected in [ + ["ProbeSet", 9, "probesetDatasetName", "Id, Name, FullName, ShortName, DataScale", "ProbeSetFreeze", {"dataset_id": None, "dataset_name": "probesetDatasetName", "dataset_fullname": "probesetDatasetName"}], - ["Geno", 3, "genoTraitName", "genoDatasetName", + ["Geno", 3, "genoDatasetName", "Id, Name, FullName, ShortName", "GenoFreeze", {}], - ["Publish", 6, "publishTraitName", "publishDatasetName", + ["Publish", 6, "publishDatasetName", "Id, Name, FullName, ShortName", "PublishFreeze", {}]]: db_mock = mock.MagicMock() with self.subTest(trait_type=trait_type): @@ -30,16 +30,15 @@ class TestDatasetsDBFunctions(TestCase): cursor.fetchone.return_value = {} self.assertEqual( retrieve_dataset_name( - trait_type, thresh, trait_name, dataset_name, db_mock), + trait_type, thresh, dataset_name, db_mock), expected) cursor.execute.assert_called_once_with( - "SELECT {cols} " - "FROM {table} " + f"SELECT {columns} " + f"FROM {table} " "WHERE public > %(threshold)s AND " "(Name = %(name)s " "OR FullName = %(name)s " - "OR ShortName = %(name)s)".format( - table=table, cols=columns), + "OR ShortName = %(name)s)", {"threshold": thresh, "name": dataset_name}) @pytest.mark.unit_test |