aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorBonfaceKilz2021-05-10 21:07:50 +0300
committerBonfaceKilz2021-05-10 21:07:50 +0300
commit3728b26ed5bd3cbd384dab6907e2518c6c7cf30b (patch)
tree088bf4e5586c791acb3876016daa68b5a362be2a /tests/unit
parentc2ef963c2f0f8a4c9428d48abed1094ff0441935 (diff)
downloadgenenetwork3-3728b26ed5bd3cbd384dab6907e2518c6c7cf30b.tar.gz
tests: test_species: Add test for `get_all_species`
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/db/test_species.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/db/test_species.py b/tests/unit/db/test_species.py
index 43b5f51..b2c4844 100644
--- a/tests/unit/db/test_species.py
+++ b/tests/unit/db/test_species.py
@@ -3,10 +3,12 @@ from unittest import TestCase
from unittest import mock
from gn3.db.species import get_chromosome
+from gn3.db.species import get_all_species
class TestChromosomes(TestCase):
"""Test cases for fetching chromosomes"""
+
def test_get_chromosome_using_species_name(self):
"""Test that the chromosome is fetched using a species name"""
db_mock = mock.MagicMock()
@@ -36,3 +38,13 @@ class TestChromosomes(TestCase):
"Chr_Length.SpeciesId = InbredSet.SpeciesId AND "
"InbredSet.Name = 'TestCase' ORDER BY OrderId"
)
+
+ def test_get_all_species(self):
+ """Test that species are fetched correctly"""
+ db_mock = mock.MagicMock()
+ with db_mock.cursor() as cursor:
+ cursor.fetchall.return_value = ()
+ self.assertEqual(get_all_species(db_mock), ())
+ cursor.execute.assert_called_once_with(
+ "SELECT Name, MenuName FROM Species ORDER BY OrderId"
+ )