mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-23 04:01:02 +02:00
Rev gateway tests
This commit is contained in:
parent
a96489b037
commit
eed008530d
3 changed files with 30 additions and 39 deletions
|
|
@ -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"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue