File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55from app .main import app
66from app .tests .utils import delete_test_data , user_example
77from fastapi .testclient import TestClient
8+ from unittest .mock import AsyncMock , patch
9+
10+
11+ @pytest .fixture (autouse = True )
12+ def mock_rabbitmq ():
13+ """Mock RabbitMQ connections for all tests"""
14+ with patch ('aio_pika.connect_robust' ) as mock_connect :
15+ mock_channel = AsyncMock ()
16+ mock_exchange = AsyncMock ()
17+ mock_connection = AsyncMock ()
18+
19+ mock_connect .return_value = mock_connection
20+ mock_connection .__aenter__ .return_value = mock_connection
21+ mock_connection .channel .return_value = mock_channel
22+ mock_channel .declare_exchange .return_value = mock_exchange
23+
24+ yield mock_connect
825
926settings .MONGO_DATABASE = "clowder-tests"
1027settings .elasticsearch_index = "clowder-tests"
You can’t perform that action at this time.
0 commit comments