Skip to content

Commit 8f741fb

Browse files
Michael Christensenim-michaelc
authored andcommitted
fix: mock database connection in tests and fix CodeQL permissions
1 parent e1d278a commit 8f741fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/amazon-keyspaces-mcp-server/tests/test_main.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,24 @@
1515

1616
import inspect
1717
from awslabs.amazon_keyspaces_mcp_server.server import main
18-
from unittest.mock import patch
18+
from unittest.mock import AsyncMock, patch
1919

2020

2121
class TestMain:
2222
"""Tests for the main function."""
2323

2424
@patch('awslabs.amazon_keyspaces_mcp_server.server.mcp.run')
25+
@patch('awslabs.amazon_keyspaces_mcp_server.client.UnifiedCassandraClient.get_session')
2526
@patch('sys.argv', ['awslabs.amazon-keyspaces-mcp-server'])
26-
def test_main_default(self, mock_run):
27+
def test_main_default(self, mock_get_session, mock_run):
2728
"""Test main function with default arguments.
2829
2930
This test verifies that:
3031
1. The main function runs without errors
3132
2. The mcp.run method is called once
3233
3. No transport parameter is passed to mcp.run
3334
"""
35+
mock_get_session.return_value = AsyncMock()
3436
main()
3537
mock_run.assert_called_once()
3638
assert mock_run.call_args[1].get('transport') is None

0 commit comments

Comments
 (0)