Fix tests

This commit is contained in:
Cyber MacGeddon 2025-09-25 23:55:41 +01:00
parent 779430f5ce
commit 12fadd0ad6
2 changed files with 36 additions and 12 deletions

View file

@ -18,7 +18,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase):
def test_parameter_spec_registration(self, mock_async_init):
"""Test that parameter specs can be registered with flow processors"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',
@ -50,7 +52,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase):
def test_mixed_specification_types(self, mock_async_init):
"""Test registration of mixed specification types (parameters, consumers, producers)"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',
@ -85,7 +89,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase):
def test_parameter_spec_metadata(self, mock_async_init):
"""Test parameter specification metadata handling"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',
@ -118,7 +124,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase):
def test_duplicate_parameter_spec_handling(self, mock_async_init):
"""Test handling of duplicate parameter spec registration"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',
@ -147,7 +155,9 @@ class TestFlowParameterSpecs(IsolatedAsyncioTestCase):
async def test_parameter_specs_available_to_flows(self, mock_async_init, mock_flow_class):
"""Test that parameter specs are available when flows are created"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',
@ -187,7 +197,9 @@ class TestParameterSpecValidation(IsolatedAsyncioTestCase):
def test_parameter_spec_name_validation(self, mock_async_init):
"""Test parameter spec name validation"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-flow-processor',

View file

@ -18,7 +18,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
def test_parameter_specs_registration(self, mock_async_init):
"""Test that LLM service registers model and temperature parameter specs"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',
@ -40,7 +42,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
def test_model_parameter_spec_properties(self, mock_async_init):
"""Test that model parameter spec has correct properties"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',
@ -64,7 +68,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
def test_temperature_parameter_spec_properties(self, mock_async_init):
"""Test that temperature parameter spec has correct properties"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',
@ -88,7 +94,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
async def test_on_request_extracts_parameters_from_flow(self, mock_async_init):
"""Test that on_request method extracts model and temperature from flow"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',
@ -147,7 +155,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
async def test_on_request_handles_missing_parameters_gracefully(self, mock_async_init):
"""Test that on_request handles missing parameters gracefully"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',
@ -198,7 +208,9 @@ class TestLlmServiceParameters(IsolatedAsyncioTestCase):
async def test_on_request_error_handling_preserves_behavior(self, mock_async_init):
"""Test that parameter extraction doesn't break existing error handling"""
# Arrange
mock_async_init.return_value = None
def mock_init(self, **kwargs):
self.config_handlers = [] # Initialize required attribute
mock_async_init.side_effect = mock_init
config = {
'id': 'test-llm-service',