Fix tests (#593)

* Fix unit/integration/contract tests which were broken by messaging fabric work
This commit is contained in:
cybermaggedon 2025-12-19 08:53:21 +00:00 committed by GitHub
parent 34eb083836
commit 5304f96fe6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 461 additions and 439 deletions

View file

@ -14,19 +14,20 @@ from trustgraph.base.async_processor import AsyncProcessor
class TestAsyncProcessorSimple(IsolatedAsyncioTestCase):
"""Test AsyncProcessor base class functionality"""
@patch('trustgraph.base.async_processor.PulsarClient')
@patch('trustgraph.base.async_processor.get_pubsub')
@patch('trustgraph.base.async_processor.Consumer')
@patch('trustgraph.base.async_processor.ProcessorMetrics')
@patch('trustgraph.base.async_processor.ConsumerMetrics')
async def test_async_processor_initialization_basic(self, mock_consumer_metrics, mock_processor_metrics,
mock_consumer, mock_pulsar_client):
async def test_async_processor_initialization_basic(self, mock_consumer_metrics, mock_processor_metrics,
mock_consumer, mock_get_pubsub):
"""Test basic AsyncProcessor initialization"""
# Arrange
mock_pulsar_client.return_value = MagicMock()
mock_backend = MagicMock()
mock_get_pubsub.return_value = mock_backend
mock_consumer.return_value = MagicMock()
mock_processor_metrics.return_value = MagicMock()
mock_consumer_metrics.return_value = MagicMock()
config = {
'id': 'test-async-processor',
'taskgroup': AsyncMock()
@ -42,14 +43,14 @@ class TestAsyncProcessorSimple(IsolatedAsyncioTestCase):
assert processor.running == True
assert hasattr(processor, 'config_handlers')
assert processor.config_handlers == []
# Verify PulsarClient was created
mock_pulsar_client.assert_called_once_with(**config)
# Verify get_pubsub was called to create backend
mock_get_pubsub.assert_called_once_with(**config)
# Verify metrics were initialized
mock_processor_metrics.assert_called_once()
mock_consumer_metrics.assert_called_once()
# Verify Consumer was created for config subscription
mock_consumer.assert_called_once()