From 23c6b0686841ce6e764687c9bd0c68f67cca26fb Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Mon, 22 Dec 2025 14:45:14 -0300 Subject: [PATCH] SIENTIAPDE-1445 Refactor test cases in test_orchestrator_functions.py to consolidate read_tags structure and enhance clarity in API error handling, improving test robustness and readability. --- .../utils/test_orchestrator_functions.py | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tests/orchestrator/utils/test_orchestrator_functions.py b/tests/orchestrator/utils/test_orchestrator_functions.py index f440f3a..805a21e 100644 --- a/tests/orchestrator/utils/test_orchestrator_functions.py +++ b/tests/orchestrator/utils/test_orchestrator_functions.py @@ -221,7 +221,15 @@ def test_predictions_batch(mock_process_path_priority, mock_overlap_filter_confi [call({'EMPTY_DATA': {'policy': 'STOP', 'config': {}}}, config['input_filters'])] ) mock_overlap_filter_config.assert_has_calls( - [call({'API_ERROR': {'policy': 'STOP', 'config': {}}}, config['mlflow_transform_filters'])] + [ + call( + { + 'EMPTY_DATA': {'policy': 'STOP', 'config': {}}, + 'API_ERROR': {'policy': 'STOP', 'config': {}}, + }, + config['mlflow_transform_filters'], + ) + ] ) mock_overlap_filter_config.assert_has_calls( [call({'API_ERROR': {'policy': 'STOP', 'config': {}}}, config['mlflow_predict_filters'])] @@ -553,14 +561,13 @@ def test_pi_web_api_scouter(): 'model_id': 'test_model_id', 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'filters': [{'filter_name': 'test_filter_name', 'policy': 'test_policy'}], - 'read_tags': [ - { - 'tag_name': 'test_tag_name', + 'read_tags': { + 'test_tag_name': { 'webid': 'test_webid', 'aggr_func': 'test_aggr_func', 'data_range': [1, 2], } - ], + }, 'tag_retention_minutes': 10, 'pi_web_api_config': { 'endpoint': 'https://test-endpoint.com', @@ -613,12 +620,11 @@ def test_pi_web_api_scouter_with_timeout_greater_than_frequency(): 'model_id': 'test_model_id', 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'filters': [], - 'read_tags': [ - { - 'tag_name': 'test_tag_name', + 'read_tags': { + 'test_tag_name': { 'webid': 'test_webid', } - ], + }, 'tag_retention_minutes': 10, 'pi_web_api_config': { 'endpoint': 'https://test-endpoint.com', @@ -665,12 +671,11 @@ def test_pi_web_api_scouter_with_no_timeout(): 'model_id': 'test_model_id', 'model': {'name': 'test_model_name', 'model_config': {'test_config': 'test_config'}}, 'filters': [], - 'read_tags': [ - { - 'tag_name': 'test_tag_name', + 'read_tags': { + 'test_tag_name': { 'webid': 'test_webid', } - ], + }, 'tag_retention_minutes': 10, 'pi_web_api_config': { 'endpoint': 'https://test-endpoint.com',