aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/db
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-04 07:24:40 +0300
committerFrederick Muriuki Muriithi2023-08-04 07:24:40 +0300
commit302b7e0844edd4c5e26b6af6370289bded01b2ea (patch)
treeda4bbde4218ae3fa087cd34e2b768c477cb105bd /tests/unit/db
parenta0b5021647940b9063ae3719b486a7c297d048c4 (diff)
downloadgenenetwork3-302b7e0844edd4c5e26b6af6370289bded01b2ea.tar.gz
Remove tests for deleted function.
Diffstat (limited to 'tests/unit/db')
-rw-r--r--tests/unit/db/test_db.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/tests/unit/db/test_db.py b/tests/unit/db/test_db.py
index 5e146fd..ff66790 100644
--- a/tests/unit/db/test_db.py
+++ b/tests/unit/db/test_db.py
@@ -4,49 +4,13 @@ from unittest import mock
import pytest
-from gn3.db import update
from gn3.db import diff_from_dict
-from gn3.db.phenotypes import Phenotype
class TestCrudMethods(TestCase):
"""Test cases for CRUD methods"""
@pytest.mark.unit_test
- def test_update_phenotype_with_no_data(self):
- """Test that a phenotype is updated correctly if an empty Phenotype dataclass
- is provided
-
- """
- db_mock = mock.MagicMock()
- self.assertEqual(update(
- conn=db_mock, table="Phenotype",
- data=Phenotype(), where=Phenotype()), None)
-
- @pytest.mark.unit_test
- def test_update_phenotype_with_data(self):
- """
- Test that a phenotype is updated correctly if some
- data is provided
- """
- db_mock = mock.MagicMock()
- with db_mock.cursor() as cursor:
- type(cursor).rowcount = 1
- self.assertEqual(update(
- conn=db_mock, table="Phenotype",
- data=Phenotype(
- pre_pub_description="Test Pre Pub",
- submitter="Rob",
- post_pub_description="Test Post Pub"),
- where=Phenotype(id_=1, owner="Rob")), 1)
- cursor.execute.assert_called_once_with(
- "UPDATE Phenotype SET "
- "Pre_publication_description = %s, "
- "Post_publication_description = %s, "
- "Submitter = %s WHERE id = %s AND Owner = %s",
- ('Test Pre Pub', 'Test Post Pub', 'Rob', 1, 'Rob'))
-
- @pytest.mark.unit_test
def test_diff_from_dict(self):
"""Test that a correct diff is generated"""
self.assertEqual(diff_from_dict({"id": 1, "data": "a"},