Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

test: use sqlite_session in node execution list test (#44998)

hjeesumca35795cd6c0
diff --git a/api/tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline_workflow.py b/api/tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline_workflow.py
index 301fabf13f0..a7b601cd2e6 100644
--- a/api/tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline_workflow.py
+++ b/api/tests/unit_tests/controllers/console/datasets/rag_pipeline/test_rag_pipeline_workflow.py
@@ -1575,20 +1575,26 @@ class TestRagPipelineWorkflowApisCases:
method(api, pipeline, "node1")
class TestRagPipelineWorkflowRunNodeExecutionListApi:
- def test_get_node_executions_passes_current_user(self, app: Flask) -> None:
+ def test_get_node_executions_passes_current_user(self, app: Flask, sqlite_session: Session) -> None:
api = RagPipelineWorkflowRunNodeExecutionListApi()
method = unwrap(api.get)
user = _rag_pipeline_workflow_apis_make_account()
pipeline = make_pipeline()
run_id = uuid4()
- node_exec = make_node_execution(workflow_run_id=str(run_id))
- session_stub = MagicMock()
- session_stub.scalar.return_value = None
+ creator = Account(name="Creator", email=f"creator-{uuid4()}@example.com")
+ creator.id = str(uuid4())
+ decoy = Account(name="Decoy", email=f"decoy-{uuid4()}@example.com")
+ decoy.id = str(uuid4())
+ sqlite_session.add_all([creator, decoy])
+ sqlite_session.commit()
+
+ node_exec = make_node_execution(workflow_run_id=str(run_id), created_by=creator.id)
+
service = MagicMock()
service.get_rag_pipeline_workflow_run_node_executions.return_value = [
- node_execution_response_source(node_exec, session=session_stub)
+ node_execution_response_source(node_exec, session=sqlite_session)
]
with (
@@ -1608,6 +1614,8 @@ class TestRagPipelineWorkflowApisCases:
assert result["data"][0]["id"] == "node-exec-1"
assert result["data"][0]["inputs"] == {"query": "hello"}
assert result["data"][0]["outputs"] == {"answer": "world"}
+ assert result["data"][0]["created_by_account"]["id"] == creator.id
+ assert result["data"][0]["created_by_account"]["name"] == "Creator"
class TestRagPipelineDatasourceVariableApi:
def test_set_datasource_variables_success(self, app: Flask) -> None: