From 9796cede72baa3e1b64a2cd7e15504e14554543a Mon Sep 17 00:00:00 2001 From: -LAN- Date: Wed, 10 Sep 2025 02:54:01 +0800 Subject: [PATCH] fix: add missing type field to node configurations in integration tests - Added 'type' field to all node data configurations in test files - Fixed test_code.py: added 'type: code' to all code node configs - Fixed test_http.py: added 'type: http-request' to all HTTP node configs - Fixed test_template_transform.py: added 'type: template-transform' to template node config - Fixed test_tool.py: added 'type: tool' to all tool node configs - Added setup_code_executor_mock fixture to test_execute_code_scientific_notation These changes fix the ValueError: 'Node X missing or invalid type information' errors that were occurring due to changes in the node factory validation requirements. --- .../integration_tests/workflow/nodes/test_code.py | 8 +++++++- .../integration_tests/workflow/nodes/test_http.py | 14 ++++++++++++++ .../workflow/nodes/test_template_transform.py | 1 + .../integration_tests/workflow/nodes/test_tool.py | 2 ++ 4 files changed, 24 insertions(+), 1 deletion(-) diff --git a/api/tests/integration_tests/workflow/nodes/test_code.py b/api/tests/integration_tests/workflow/nodes/test_code.py index a8f3253b35..e2f3a74bf9 100644 --- a/api/tests/integration_tests/workflow/nodes/test_code.py +++ b/api/tests/integration_tests/workflow/nodes/test_code.py @@ -89,6 +89,7 @@ def test_execute_code(setup_code_executor_mock): code_config = { "id": "code", "data": { + "type": "code", "outputs": { "result": { "type": "number", @@ -135,6 +136,7 @@ def test_execute_code_output_validator(setup_code_executor_mock): code_config = { "id": "code", "data": { + "type": "code", "outputs": { "result": { "type": "string", @@ -180,6 +182,7 @@ def test_execute_code_output_validator_depth(): code_config = { "id": "code", "data": { + "type": "code", "outputs": { "string_validator": { "type": "string", @@ -298,6 +301,7 @@ def test_execute_code_output_object_list(): code_config = { "id": "code", "data": { + "type": "code", "outputs": { "object_list": { "type": "array[object]", @@ -358,7 +362,8 @@ def test_execute_code_output_object_list(): node._transform_result(result, node._node_data.outputs) -def test_execute_code_scientific_notation(): +@pytest.mark.parametrize("setup_code_executor_mock", [["none"]], indirect=True) +def test_execute_code_scientific_notation(setup_code_executor_mock): code = """ def main(): return { @@ -370,6 +375,7 @@ def test_execute_code_scientific_notation(): code_config = { "id": "code", "data": { + "type": "code", "outputs": { "result": { "type": "number", diff --git a/api/tests/integration_tests/workflow/nodes/test_http.py b/api/tests/integration_tests/workflow/nodes/test_http.py index 5e900342ce..ea99beacaa 100644 --- a/api/tests/integration_tests/workflow/nodes/test_http.py +++ b/api/tests/integration_tests/workflow/nodes/test_http.py @@ -77,6 +77,7 @@ def test_get(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -110,6 +111,7 @@ def test_no_auth(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -139,6 +141,7 @@ def test_custom_authorization_header(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -231,6 +234,7 @@ def test_bearer_authorization_with_custom_header_ignored(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -271,6 +275,7 @@ def test_basic_authorization_with_custom_header_ignored(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -310,6 +315,7 @@ def test_custom_authorization_with_empty_api_key(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -343,6 +349,7 @@ def test_template(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -378,6 +385,7 @@ def test_json(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "post", @@ -420,6 +428,7 @@ def test_x_www_form_urlencoded(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "post", @@ -467,6 +476,7 @@ def test_form_data(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "post", @@ -517,6 +527,7 @@ def test_none_data(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "post", @@ -550,6 +561,7 @@ def test_mock_404(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -579,6 +591,7 @@ def test_multi_colons_parse(setup_http_mock): config={ "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", @@ -635,6 +648,7 @@ def test_nested_object_variable_selector(setup_http_mock): { "id": "1", "data": { + "type": "http-request", "title": "http", "desc": "", "method": "get", diff --git a/api/tests/integration_tests/workflow/nodes/test_template_transform.py b/api/tests/integration_tests/workflow/nodes/test_template_transform.py index 02a8460ce6..53252c7f2e 100644 --- a/api/tests/integration_tests/workflow/nodes/test_template_transform.py +++ b/api/tests/integration_tests/workflow/nodes/test_template_transform.py @@ -20,6 +20,7 @@ def test_execute_code(setup_code_executor_mock): config = { "id": "1", "data": { + "type": "template-transform", "title": "123", "variables": [ { diff --git a/api/tests/integration_tests/workflow/nodes/test_tool.py b/api/tests/integration_tests/workflow/nodes/test_tool.py index 780fe0bee6..16d44d1eaf 100644 --- a/api/tests/integration_tests/workflow/nodes/test_tool.py +++ b/api/tests/integration_tests/workflow/nodes/test_tool.py @@ -70,6 +70,7 @@ def test_tool_variable_invoke(): config={ "id": "1", "data": { + "type": "tool", "title": "a", "desc": "a", "provider_id": "time", @@ -101,6 +102,7 @@ def test_tool_mixed_invoke(): config={ "id": "1", "data": { + "type": "tool", "title": "a", "desc": "a", "provider_id": "time",