mirror of
https://github.com/langgenius/dify.git
synced 2026-04-28 11:56:55 +08:00
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.
This commit is contained in:
parent
836ed1f380
commit
9796cede72
@ -89,6 +89,7 @@ def test_execute_code(setup_code_executor_mock):
|
|||||||
code_config = {
|
code_config = {
|
||||||
"id": "code",
|
"id": "code",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "code",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"result": {
|
"result": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
@ -135,6 +136,7 @@ def test_execute_code_output_validator(setup_code_executor_mock):
|
|||||||
code_config = {
|
code_config = {
|
||||||
"id": "code",
|
"id": "code",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "code",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"result": {
|
"result": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -180,6 +182,7 @@ def test_execute_code_output_validator_depth():
|
|||||||
code_config = {
|
code_config = {
|
||||||
"id": "code",
|
"id": "code",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "code",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"string_validator": {
|
"string_validator": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -298,6 +301,7 @@ def test_execute_code_output_object_list():
|
|||||||
code_config = {
|
code_config = {
|
||||||
"id": "code",
|
"id": "code",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "code",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"object_list": {
|
"object_list": {
|
||||||
"type": "array[object]",
|
"type": "array[object]",
|
||||||
@ -358,7 +362,8 @@ def test_execute_code_output_object_list():
|
|||||||
node._transform_result(result, node._node_data.outputs)
|
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 = """
|
code = """
|
||||||
def main():
|
def main():
|
||||||
return {
|
return {
|
||||||
@ -370,6 +375,7 @@ def test_execute_code_scientific_notation():
|
|||||||
code_config = {
|
code_config = {
|
||||||
"id": "code",
|
"id": "code",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "code",
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"result": {
|
"result": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
|
|||||||
@ -77,6 +77,7 @@ def test_get(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -110,6 +111,7 @@ def test_no_auth(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -139,6 +141,7 @@ def test_custom_authorization_header(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -231,6 +234,7 @@ def test_bearer_authorization_with_custom_header_ignored(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -271,6 +275,7 @@ def test_basic_authorization_with_custom_header_ignored(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -310,6 +315,7 @@ def test_custom_authorization_with_empty_api_key(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -343,6 +349,7 @@ def test_template(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -378,6 +385,7 @@ def test_json(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
@ -420,6 +428,7 @@ def test_x_www_form_urlencoded(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
@ -467,6 +476,7 @@ def test_form_data(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
@ -517,6 +527,7 @@ def test_none_data(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "post",
|
"method": "post",
|
||||||
@ -550,6 +561,7 @@ def test_mock_404(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -579,6 +591,7 @@ def test_multi_colons_parse(setup_http_mock):
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
@ -635,6 +648,7 @@ def test_nested_object_variable_selector(setup_http_mock):
|
|||||||
{
|
{
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "http-request",
|
||||||
"title": "http",
|
"title": "http",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"method": "get",
|
"method": "get",
|
||||||
|
|||||||
@ -20,6 +20,7 @@ def test_execute_code(setup_code_executor_mock):
|
|||||||
config = {
|
config = {
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "template-transform",
|
||||||
"title": "123",
|
"title": "123",
|
||||||
"variables": [
|
"variables": [
|
||||||
{
|
{
|
||||||
|
|||||||
@ -70,6 +70,7 @@ def test_tool_variable_invoke():
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "tool",
|
||||||
"title": "a",
|
"title": "a",
|
||||||
"desc": "a",
|
"desc": "a",
|
||||||
"provider_id": "time",
|
"provider_id": "time",
|
||||||
@ -101,6 +102,7 @@ def test_tool_mixed_invoke():
|
|||||||
config={
|
config={
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"data": {
|
"data": {
|
||||||
|
"type": "tool",
|
||||||
"title": "a",
|
"title": "a",
|
||||||
"desc": "a",
|
"desc": "a",
|
||||||
"provider_id": "time",
|
"provider_id": "time",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user