diff --git a/tests/unit/test_gateway/test_dispatch_config.py b/tests/unit/test_gateway/test_dispatch_config.py index 8f8cf601..8932190b 100644 --- a/tests/unit/test_gateway/test_dispatch_config.py +++ b/tests/unit/test_gateway/test_dispatch_config.py @@ -51,9 +51,9 @@ class TestConfigRequestor: # Setup translator response mock_request_translator.to_pulsar.return_value = "translated_request" - # Temporarily patch ServiceRequestor async methods to prevent coroutine warnings - with patch.object(ServiceRequestor, 'start', new_callable=AsyncMock), \ - patch.object(ServiceRequestor, 'process', new_callable=AsyncMock): + # Patch ServiceRequestor async methods with regular mocks (not AsyncMock) + with patch.object(ServiceRequestor, 'start', return_value=None), \ + patch.object(ServiceRequestor, 'process', return_value=None): requestor = ConfigRequestor( pulsar_client=MagicMock(), consumer="test-consumer", diff --git a/tests/unit/test_gateway/test_service.py b/tests/unit/test_gateway/test_service.py index 551d7759..d5730eff 100644 --- a/tests/unit/test_gateway/test_service.py +++ b/tests/unit/test_gateway/test_service.py @@ -10,11 +10,7 @@ import pulsar from trustgraph.gateway.service import Api, run, default_pulsar_host, default_prometheus_url, default_timeout, default_port, default_api_token -# Store the original method before patching -_original_app_factory = Api.app_factory - -# Replace with AsyncMock to prevent coroutine warnings during introspection -Api.app_factory = AsyncMock() +# Tests for Gateway Service API class TestApi: @@ -128,9 +124,6 @@ class TestApi: api = Api() - # Temporarily restore the real app_factory for this test - api.app_factory = _original_app_factory.__get__(api, Api) - # Mock the dependencies api.config_receiver = Mock() api.config_receiver.start = AsyncMock() @@ -158,9 +151,6 @@ class TestApi: api = Api() - # Temporarily restore the real app_factory for this test - api.app_factory = _original_app_factory.__get__(api, Api) - # Mock custom endpoints mock_endpoint1 = Mock() mock_endpoint1.add_routes = Mock()