mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-27 01:36:30 +02:00
feat(filesystem): add local folder backend and verification coverage
This commit is contained in:
parent
15a9e8b085
commit
42d2d2222e
4 changed files with 476 additions and 0 deletions
|
|
@ -0,0 +1,37 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from app.agents.new_chat.filesystem_backends import build_backend_resolver
|
||||
from app.agents.new_chat.filesystem_selection import (
|
||||
ClientPlatform,
|
||||
FilesystemMode,
|
||||
FilesystemSelection,
|
||||
)
|
||||
from app.agents.new_chat.middleware.local_folder_backend import LocalFolderBackend
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
|
||||
class _RuntimeStub:
|
||||
state = {"files": {}}
|
||||
|
||||
|
||||
def test_backend_resolver_returns_local_backend_for_local_mode(tmp_path: Path):
|
||||
selection = FilesystemSelection(
|
||||
mode=FilesystemMode.DESKTOP_LOCAL_FOLDER,
|
||||
client_platform=ClientPlatform.DESKTOP,
|
||||
local_root_path=str(tmp_path),
|
||||
)
|
||||
resolver = build_backend_resolver(selection)
|
||||
|
||||
backend = resolver(_RuntimeStub())
|
||||
assert isinstance(backend, LocalFolderBackend)
|
||||
|
||||
|
||||
def test_backend_resolver_uses_cloud_mode_by_default():
|
||||
resolver = build_backend_resolver(FilesystemSelection())
|
||||
backend = resolver(_RuntimeStub())
|
||||
# StateBackend class name check keeps this test decoupled
|
||||
# from internal deepagents runtime class identity.
|
||||
assert backend.__class__.__name__ == "StateBackend"
|
||||
Loading…
Add table
Add a link
Reference in a new issue