mirror of
https://github.com/langgenius/dify.git
synced 2026-07-19 16:44:00 -04:00
test: complete workflow test doubles with env/conversation variables
The secret-scrub wiring reads workflow.environment_variables / conversation_variables when building the response converter; unit tests that mock the workflow as a bare SimpleNamespace must provide these attributes (empty = no secrets). Fixes the workflow task-pipeline and HITL contract tests.
This commit is contained in:
@@ -433,7 +433,13 @@ class TestHitlServiceApi:
|
||||
)
|
||||
pipeline = AdvancedChatAppGenerateTaskPipeline(
|
||||
application_generate_entity=application_generate_entity,
|
||||
workflow=SimpleNamespace(id="workflow-id", tenant_id="tenant", features_dict={}),
|
||||
workflow=SimpleNamespace(
|
||||
id="workflow-id",
|
||||
tenant_id="tenant",
|
||||
features_dict={},
|
||||
environment_variables=[],
|
||||
conversation_variables=[],
|
||||
),
|
||||
queue_manager=SimpleNamespace(invoke_from=InvokeFrom.WEB_APP, graph_runtime_state=None),
|
||||
conversation=SimpleNamespace(id="conv-id", mode=AppMode.ADVANCED_CHAT),
|
||||
message=SimpleNamespace(
|
||||
@@ -526,7 +532,13 @@ class TestHitlServiceApi:
|
||||
)
|
||||
pipeline = WorkflowAppGenerateTaskPipeline(
|
||||
application_generate_entity=application_generate_entity,
|
||||
workflow=SimpleNamespace(id="workflow-id", tenant_id="tenant", features_dict={}),
|
||||
workflow=SimpleNamespace(
|
||||
id="workflow-id",
|
||||
tenant_id="tenant",
|
||||
features_dict={},
|
||||
environment_variables=[],
|
||||
conversation_variables=[],
|
||||
),
|
||||
queue_manager=SimpleNamespace(invoke_from=InvokeFrom.WEB_APP, graph_runtime_state=None),
|
||||
user=SimpleNamespace(id="user", session_id="session"),
|
||||
stream=False,
|
||||
|
||||
@@ -79,7 +79,13 @@ def _make_pipeline():
|
||||
extras={},
|
||||
call_depth=0,
|
||||
)
|
||||
workflow = SimpleNamespace(id="workflow-id", tenant_id="tenant", features_dict={})
|
||||
workflow = SimpleNamespace(
|
||||
id="workflow-id",
|
||||
tenant_id="tenant",
|
||||
features_dict={},
|
||||
environment_variables=[],
|
||||
conversation_variables=[],
|
||||
)
|
||||
user = SimpleNamespace(id="user", session_id="session")
|
||||
|
||||
pipeline = WorkflowAppGenerateTaskPipeline(
|
||||
@@ -505,7 +511,13 @@ class TestWorkflowGenerateTaskPipeline:
|
||||
extras={},
|
||||
call_depth=0,
|
||||
)
|
||||
workflow = SimpleNamespace(id="workflow-id", tenant_id="tenant", features_dict={})
|
||||
workflow = SimpleNamespace(
|
||||
id="workflow-id",
|
||||
tenant_id="tenant",
|
||||
features_dict={},
|
||||
environment_variables=[],
|
||||
conversation_variables=[],
|
||||
)
|
||||
queue_manager = SimpleNamespace(invoke_from=InvokeFrom.WEB_APP, graph_runtime_state=None)
|
||||
end_user = EndUser(tenant_id="tenant", type="session", name="user", session_id="session-id")
|
||||
end_user.id = "end-user-id"
|
||||
|
||||
Reference in New Issue
Block a user