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 sqlite3 session in test_generator_api_missing (#38719)

Asuka Minato7b95e2a75fa6
diff --git a/api/tests/unit_tests/controllers/console/app/test_generator_api_missing.py b/api/tests/unit_tests/controllers/console/app/test_generator_api_missing.py
index bdc3976e14e..d6f6bd703f4 100644
--- a/api/tests/unit_tests/controllers/console/app/test_generator_api_missing.py
+++ b/api/tests/unit_tests/controllers/console/app/test_generator_api_missing.py
@@ -1,5 +1,6 @@
import pytest
from flask import Flask
+from sqlalchemy.orm import Session
from controllers.console.app import generator as generator_module
from core.errors.error import ModelCurrentlyNotSupportError, ProviderTokenNotInitError, QuotaExceededError
@@ -102,12 +103,14 @@ def test_structured_output_generate_exceptions(app: Flask, monkeypatch: pytest.M
method(api, "t1")
-def test_instruction_generate_exceptions(app: Flask, monkeypatch: pytest.MonkeyPatch) -> None:
[email protected]("sqlite_session", [()], indirect=True)
+def test_instruction_generate_exceptions(
+ app: Flask,
+ monkeypatch: pytest.MonkeyPatch,
+ sqlite_session: Session,
+) -> None:
api = generator_module.InstructionGenerateApi()
method = unwrap(api.post)
- from types import SimpleNamespace
-
- session = SimpleNamespace()
exceptions_to_test = [
(ProviderTokenNotInitError("token error"), generator_module.ProviderNotInitializeError),
@@ -135,4 +138,4 @@ def test_instruction_generate_exceptions(app: Flask, monkeypatch: pytest.MonkeyP
},
):
with pytest.raises(expected_exception):
- method(api, session, "t1")
+ method(api, sqlite_session, "t1")