refactor: 重构 AgentScope 运行时模块并优化前端附件展示
This commit is contained in:
@@ -4,7 +4,7 @@ from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
|
||||
import v1.agent.attachment_storage as attachment_storage_module
|
||||
from services.base.supabase import SupabaseService
|
||||
|
||||
|
||||
class _FakeBucket:
|
||||
@@ -34,9 +34,11 @@ class _FakeStorage:
|
||||
async def test_attachment_storage_rejects_unexpected_bucket(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
storage = attachment_storage_module.AgentAttachmentStorage()
|
||||
from core.config.settings import config as app_config
|
||||
|
||||
storage = SupabaseService()
|
||||
monkeypatch.setattr(
|
||||
attachment_storage_module.config.storage,
|
||||
app_config.storage,
|
||||
"bucket",
|
||||
"allowed-bucket",
|
||||
)
|
||||
@@ -54,16 +56,18 @@ async def test_attachment_storage_rejects_unexpected_bucket(
|
||||
async def test_attachment_storage_accepts_configured_bucket(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
storage = attachment_storage_module.AgentAttachmentStorage()
|
||||
from core.config.settings import config as app_config
|
||||
|
||||
storage = SupabaseService()
|
||||
fake_bucket = _FakeBucket()
|
||||
fake_client = SimpleNamespace(storage=_FakeStorage(fake_bucket))
|
||||
monkeypatch.setattr(
|
||||
attachment_storage_module.config.storage,
|
||||
app_config.storage,
|
||||
"bucket",
|
||||
"allowed-bucket",
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
attachment_storage_module.supabase_service,
|
||||
storage,
|
||||
"get_admin_client",
|
||||
lambda: fake_client,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user