From adc7857344b2a8b9271c6e04375b97f20af0b600 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Apr 2026 10:53:30 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0UI=E5=B1=82=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E5=8A=A0=E8=BD=BD=E6=B5=8B=E8=AF=95=EF=BC=8C=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=B9=E6=B3=95=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_ui/__init__.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/test_ui/__init__.py b/tests/test_ui/__init__.py index 6497e77..22fd06b 100644 --- a/tests/test_ui/__init__.py +++ b/tests/test_ui/__init__.py @@ -180,18 +180,40 @@ class TestUIWithBackendClient: app = GraphMemoryApp(backend_server=server) client = app._backend_client - # 测试 get_status status = client.get_status() assert status.get("success") is True - # 测试 update_config - result = client.update_config(api_key="sk-test", base_url="https://api.deepseek.com") + result = client.update_settings( + api_config={"api_key": "sk-test", "base_url": "https://api.deepseek.com", "model": "deepseek-chat"}, + tool_limits={"persona_query_max": 1} + ) assert result.get("success") is True server.shutdown() finally: if os.path.exists(db_path): os.unlink(db_path) + + def test_ui_get_history(self): + from ui import GraphMemoryApp + from core import BackendServer + + with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f: + db_path = f.name + try: + server = BackendServer(db_path=db_path) + server.start(api_key="") + + app = GraphMemoryApp(backend_server=server) + client = app._backend_client + + history = client.get_history() + assert isinstance(history, list) + + server.shutdown() + finally: + if os.path.exists(db_path): + os.unlink(db_path) def test_ui_only_uses_backend_client(self): from ui import GraphMemoryApp