Rev gateway tests

This commit is contained in:
Cyber MacGeddon 2025-07-13 09:05:06 +01:00
parent a96489b037
commit eed008530d
3 changed files with 30 additions and 39 deletions

View file

@ -3,10 +3,13 @@ Tests for Gateway Config Dispatch
"""
import pytest
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch, AsyncMock
from trustgraph.gateway.dispatch.config import ConfigRequestor
# Import parent class for local patching
from trustgraph.gateway.dispatch.requestor import ServiceRequestor
class TestConfigRequestor:
"""Test cases for ConfigRequestor class"""
@ -48,11 +51,14 @@ class TestConfigRequestor:
# Setup translator response
mock_request_translator.to_pulsar.return_value = "translated_request"
requestor = ConfigRequestor(
pulsar_client=MagicMock(),
consumer="test-consumer",
subscriber="test-subscriber"
)
# Temporarily patch ServiceRequestor async methods to prevent coroutine warnings
with patch.object(ServiceRequestor, 'start', new_callable=AsyncMock), \
patch.object(ServiceRequestor, 'process', new_callable=AsyncMock):
requestor = ConfigRequestor(
pulsar_client=MagicMock(),
consumer="test-consumer",
subscriber="test-subscriber"
)
# Call to_request
result = requestor.to_request({"test": "body"})