mirror of https://github.com/langgenius/dify.git
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 = {
|
||||
"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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ def test_execute_code(setup_code_executor_mock):
|
|||
config = {
|
||||
"id": "1",
|
||||
"data": {
|
||||
"type": "template-transform",
|
||||
"title": "123",
|
||||
"variables": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue