fix: add responding error information when obtain pipeline template detail failed (#33628)

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
FFXN
2026-03-18 13:31:45 +08:00
committed by GitHub
parent 296b7044af
commit dc69f65b4b
4 changed files with 61 additions and 6 deletions

View File

@ -59,6 +59,44 @@ class TestPipelineTemplateDetailApi:
assert status == 200
assert response == template
def test_get_returns_404_when_template_not_found(self, app):
api = PipelineTemplateDetailApi()
method = unwrap(api.get)
service = MagicMock()
service.get_pipeline_template_detail.return_value = None
with (
app.test_request_context("/?type=built-in"),
patch(
"controllers.console.datasets.rag_pipeline.rag_pipeline.RagPipelineService",
return_value=service,
),
):
response, status = method(api, "non-existent-id")
assert status == 404
assert "error" in response
def test_get_returns_404_for_customized_type_not_found(self, app):
api = PipelineTemplateDetailApi()
method = unwrap(api.get)
service = MagicMock()
service.get_pipeline_template_detail.return_value = None
with (
app.test_request_context("/?type=customized"),
patch(
"controllers.console.datasets.rag_pipeline.rag_pipeline.RagPipelineService",
return_value=service,
),
):
response, status = method(api, "non-existent-id")
assert status == 404
assert "error" in response
class TestCustomizedPipelineTemplateApi:
def test_patch_success(self, app):