Rev gateway tests

This commit is contained in:
Cyber MacGeddon 2025-07-12 22:04:35 +01:00
parent 40253998fc
commit adc4311988
3 changed files with 7 additions and 4 deletions

View file

@ -406,6 +406,9 @@ class TestDispatcherManager:
mock_config_receiver = Mock()
manager = DispatcherManager(mock_pulsar_client, mock_config_receiver)
# Add flow to the flows dictionary
manager.flows["test_flow"] = {"services": {"agent": {}}}
# Pre-populate with existing dispatcher
mock_dispatcher = Mock()
mock_dispatcher.process = AsyncMock(return_value="cached_result")

View file

@ -132,7 +132,7 @@ class TestApi:
app = await api.app_factory()
assert isinstance(app, web.Application)
assert app.client_max_size == 256 * 1024 * 1024
assert app._client_max_size == 256 * 1024 * 1024
# Verify that config receiver was started
api.config_receiver.start.assert_called_once()
@ -207,7 +207,7 @@ class TestApi:
assert api.dispatcher_manager.pulsar_client == api.pulsar_client
assert api.dispatcher_manager.config_receiver == api.config_receiver
assert api.endpoint_manager.dispatcher_manager == api.dispatcher_manager
assert api.endpoint_manager.auth == api.auth
# EndpointManager doesn't store auth directly, it passes it to individual endpoints
class TestRunFunction:

View file

@ -119,7 +119,7 @@ class TestReverseGateway:
@patch('trustgraph.rev_gateway.service.ConfigReceiver')
@patch('trustgraph.rev_gateway.service.MessageDispatcher')
@patch('pulsar.Client')
@patch('aiohttp.ClientSession')
@patch('trustgraph.rev_gateway.service.ClientSession')
@pytest.mark.asyncio
async def test_reverse_gateway_connect_success(self, mock_session_class, mock_pulsar_client, mock_dispatcher, mock_config_receiver):
"""Test ReverseGateway successful connection"""
@ -143,7 +143,7 @@ class TestReverseGateway:
@patch('trustgraph.rev_gateway.service.ConfigReceiver')
@patch('trustgraph.rev_gateway.service.MessageDispatcher')
@patch('pulsar.Client')
@patch('aiohttp.ClientSession')
@patch('trustgraph.rev_gateway.service.ClientSession')
@pytest.mark.asyncio
async def test_reverse_gateway_connect_failure(self, mock_session_class, mock_pulsar_client, mock_dispatcher, mock_config_receiver):
"""Test ReverseGateway connection failure"""