diff options
Diffstat (limited to 'wqflask/tests/unit/base/test_species.py')
-rw-r--r-- | wqflask/tests/unit/base/test_species.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/wqflask/tests/unit/base/test_species.py b/wqflask/tests/unit/base/test_species.py index d7ba30a3..f12bde6d 100644 --- a/wqflask/tests/unit/base/test_species.py +++ b/wqflask/tests/unit/base/test_species.py @@ -30,17 +30,14 @@ class MockDataset: (None, "Random Dataset", None, 1))) def test_species(mocker, species_name, dataset, expected_name, chromosome_param): - mock_conn = mocker.patch("base.species.database_connection") - mock_conn.return_value.__enter__.return_value = mocker.MagicMock() _c = mocker.patch("base.species.Chromosomes", return_value=chromosome_param) - with mock_conn() as conn: - test_species = TheSpecies(dataset=dataset, - species_name=species_name) - _c.assert_called_with(conn=conn, species=species_name, - dataset=dataset) - assert test_species.name == expected_name - assert test_species.chromosomes == chromosome_param + test_species = TheSpecies(dataset=dataset, + species_name=species_name) + _c.assert_called_with(species=species_name, + dataset=dataset) + assert test_species.name == expected_name + assert test_species.chromosomes == chromosome_param @pytest.mark.parametrize( @@ -74,9 +71,8 @@ def test_create_chromosomes(mocker, species, dataset, expected_call): cursor.fetchall.return_value = (("1", 2, 10,), ("2", 3, 11,), ("4", 5, 15,),) - _c = Chromosomes(conn=mock_conn, - dataset=dataset, species=species) - assert _c.chromosomes == OrderedDict([ + _c = Chromosomes(dataset=dataset, species=species) + assert _c.chromosomes(cursor) == OrderedDict([ ("1", IndChromosome("1", 10)), ("2", IndChromosome("2", 11)), ("4", IndChromosome("4", 15)), |