feat(tasks): add skill-templated task graph execution
This commit is contained in:
@ -7,7 +7,7 @@ from fastapi.testclient import TestClient
|
||||
from beaver.interfaces.web.app import create_app
|
||||
from beaver.services.agent_service import AgentService
|
||||
from beaver.services.user_file_resolver import UserFileStorageResolver
|
||||
from beaver.services.user_files import LocalUserFileStorage, UserFileService
|
||||
from beaver.services.user_files import LocalUserFileStorage, UserFileService, UserFileStorageError
|
||||
|
||||
|
||||
def _auth_headers(app, username: str = "alice") -> dict[str, str]:
|
||||
@ -191,6 +191,26 @@ def test_user_files_api_authenticated_request_resolves_identity(tmp_path: Path,
|
||||
assert seen[0].storage_namespace == "users/alice"
|
||||
|
||||
|
||||
def test_user_files_api_reports_storage_errors_as_unavailable(tmp_path: Path, monkeypatch) -> None:
|
||||
service = AgentService(workspace=tmp_path)
|
||||
app = create_app(service=service, manage_service_lifecycle=False)
|
||||
|
||||
class BrokenStorage:
|
||||
async def list_dir(self, path: str):
|
||||
raise UserFileStorageError("User file storage list directory failed: SignatureDoesNotMatch")
|
||||
|
||||
async def fake_service(self):
|
||||
return UserFileService(BrokenStorage())
|
||||
|
||||
monkeypatch.setattr(UserFileStorageResolver, "service", fake_service)
|
||||
|
||||
with TestClient(app) as client:
|
||||
response = client.get("/api/user-files/browse", params={"path": "uploads"}, headers=_auth_headers(app))
|
||||
|
||||
assert response.status_code == 503
|
||||
assert "SignatureDoesNotMatch" in response.json()["detail"]
|
||||
|
||||
|
||||
def test_user_files_api_streams_upload_and_enforces_configured_limit(tmp_path: Path, monkeypatch) -> None:
|
||||
monkeypatch.setenv("BEAVER_USER_FILES_MAX_UPLOAD_BYTES", "5")
|
||||
service = AgentService(workspace=tmp_path)
|
||||
|
||||
Reference in New Issue
Block a user