feat: enhance mock database store with context manager support and improve cursor behavior
CI / lint-test-build (push) Failing after 52s

This commit is contained in:
2026-06-04 20:28:06 +02:00
parent 170f59eb89
commit df59f5ad7c
3 changed files with 26 additions and 2 deletions
+9 -1
View File
@@ -36,6 +36,7 @@ def test_config_setting_repository_create_setting(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -79,6 +80,7 @@ def test_config_setting_repository_get_setting(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -112,6 +114,7 @@ def test_config_setting_repository_update_setting(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -155,6 +158,7 @@ def test_config_setting_repository_list_settings(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -198,6 +202,7 @@ def test_config_setting_repository_get_latest_updated_at(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -224,6 +229,7 @@ def test_config_pairing_repository_create_pairing(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value
@@ -238,7 +244,8 @@ def test_config_pairing_repository_create_pairing(mock_store):
]
# Create pairing
pairing = ConfigPairing(base_asset="BTC", quote_asset="USD", enabled=True, source="Kraken")
pairing = ConfigPairing(
base_asset="BTC", quote_asset="USD", enabled=True, source="Kraken")
result = repo.create_pairing(pairing)
@@ -257,6 +264,7 @@ def test_config_pairing_repository_get_pairing(mock_store):
# Mock database connection
with patch.object(mock_store, "connect") as mock_connect:
mock_cursor = Mock()
mock_cursor.execute.return_value = mock_cursor
mock_connect.return_value.__enter__.return_value = mock_cursor
# Mock the return value