about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/db/test_case_attributes.py126
1 files changed, 0 insertions, 126 deletions
diff --git a/tests/unit/db/test_case_attributes.py b/tests/unit/db/test_case_attributes.py
index 5617362..1a2a8ae 100644
--- a/tests/unit/db/test_case_attributes.py
+++ b/tests/unit/db/test_case_attributes.py
@@ -6,7 +6,6 @@ import os
 from pytest_mock import MockFixture
 from gn3.db.case_attributes import queue_edit
 from gn3.db.case_attributes import CaseAttributeEdit
-from gn3.db.case_attributes import approve_case_attribute
 
 
 @pytest.mark.unit_test
@@ -26,128 +25,3 @@ def test_queue_edit(mocker: MockFixture) -> None:
             "ON DUPLICATE KEY UPDATE status=%s",
             ('review', 'xxxx', '{"a": 1, "b": 2}', 'review'))
         assert {28} == review_ids
-
-
-@pytest.mark.unit_test
-def test_approve_inserting_case_attribute(mocker: MockFixture) -> None:
-    """Test approving inserting a case-attribute"""
-    mock_conn = mocker.MagicMock()
-    with mock_conn.cursor() as cursor:
-        type(cursor).rowcount = 1
-        cursor.fetchone.return_value = (
-            """
-        {"Insert": {"name": "test", "description": "Random Description"}}
-        """,
-        )
-        _ = approve_case_attribute(
-            mock_conn,
-            case_attr_audit_id=3,
-        )
-        calls = [
-            mocker.call(
-                "SELECT json_diff_data FROM caseattributes_audit "
-                "WHERE id = %s",
-                (3,),
-            ),
-            mocker.call(
-                "INSERT INTO CaseAttribute "
-                "(Name, Description) VALUES "
-                "(%s, %s)",
-                (
-                    "test",
-                    "Random Description",
-                ),
-            ),
-            mocker.call(
-                "UPDATE caseattributes_audit SET "
-                "status = 'approved' WHERE id = %s",
-                (3,),
-            ),
-        ]
-        cursor.execute.assert_has_calls(calls, any_order=False)
-
-
-@pytest.mark.unit_test
-def test_approve_deleting_case_attribute(mocker: MockFixture) -> None:
-    """Test deleting a case-attribute"""
-    mock_conn = mocker.MagicMock()
-    with mock_conn.cursor() as cursor:
-        type(cursor).rowcount = 1
-        cursor.fetchone.return_value = (
-            """
-        {"Deletion": {"id": "12", "name": "test", "description": ""}}
-        """,
-        )
-        _ = approve_case_attribute(
-            mock_conn,
-            case_attr_audit_id=3,
-        )
-        calls = [
-            mocker.call(
-                "SELECT json_diff_data FROM caseattributes_audit "
-                "WHERE id = %s",
-                (3,),
-            ),
-            mocker.call("DELETE FROM CaseAttribute WHERE Id = %s", ("12",)),
-            mocker.call(
-                "UPDATE caseattributes_audit SET "
-                "status = 'approved' WHERE id = %s",
-                (3,),
-            ),
-        ]
-        cursor.execute.assert_has_calls(calls, any_order=False)
-
-
-@pytest.mark.unit_test
-def test_approve_modifying_case_attribute(mocker: MockFixture) -> None:
-    """Test modifying a case-attribute"""
-    mock_conn = mocker.MagicMock()
-    with mock_conn.cursor() as cursor:
-        type(cursor).rowcount = 1
-        cursor.fetchone.return_value = (
-            """
-{
-  "id": "12",
-  "Modification": {
-    "description": {
-      "Current": "Test",
-      "Original": "A"
-    },
-    "name": {
-      "Current": "Height (A)",
-      "Original": "Height"
-    }
-  }
-}""",
-        )
-        _ = approve_case_attribute(
-            mock_conn,
-            case_attr_audit_id=3,
-        )
-        calls = [
-            mocker.call(
-                "SELECT json_diff_data FROM caseattributes_audit "
-                "WHERE id = %s",
-                (3,),
-            ),
-            mocker.call(
-                "UPDATE CaseAttribute SET Description = %s WHERE Id = %s",
-                (
-                    "Test",
-                    "12",
-                ),
-            ),
-            mocker.call(
-                "UPDATE CaseAttribute SET Name = %s WHERE Id = %s",
-                (
-                    "Height (A)",
-                    "12",
-                ),
-            ),
-            mocker.call(
-                "UPDATE caseattributes_audit SET "
-                "status = 'approved' WHERE id = %s",
-                (3,),
-            ),
-        ]
-        cursor.execute.assert_has_calls(calls, any_order=False)