Skip to content

Commit c457d80

Browse files
author
Vansh Kalra
committed
Fixed test_main.py to ignore MongoDB errors for check_database_health function
1 parent 1adfe86 commit c457d80

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

state-manager/tests/unit/test_main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class TestLifespan:
114114
})
115115
@patch('app.main.init_beanie', new_callable=AsyncMock)
116116
@patch('app.main.AsyncMongoClient')
117-
@patch('app.main.LogsManager')
118-
async def test_lifespan_startup_success(self, mock_logs_manager, mock_mongo_client, mock_init_beanie):
117+
@patch('app.main.check_database_health', new_callable=AsyncMock)
118+
async def test_lifespan_startup_success(self, mock_health_check, mock_logs_manager, mock_mongo_client, mock_init_beanie):
119119
"""Test successful lifespan startup"""
120120
# Setup mocks
121121
mock_logger = MagicMock()
@@ -176,8 +176,8 @@ async def test_lifespan_empty_secret_raises_error(self, mock_logs_manager, mock_
176176
})
177177
@patch('app.main.init_beanie', new_callable=AsyncMock)
178178
@patch('app.main.AsyncMongoClient')
179-
@patch('app.main.LogsManager')
180-
async def test_lifespan_init_beanie_with_correct_models(self, mock_logs_manager, mock_mongo_client, mock_init_beanie):
179+
@patch('app.main.check_database_health', new_callable=AsyncMock)
180+
async def test_lifespan_init_beanie_with_correct_models(self, mock_health_check, mock_logs_manager, mock_mongo_client, mock_init_beanie):
181181
"""Test that init_beanie is called with correct document models"""
182182
mock_logger = MagicMock()
183183
mock_logs_manager.return_value.get_logger.return_value = mock_logger

0 commit comments

Comments
 (0)