样式修改
This commit is contained in:
1 parent
23b9d401b7
commit
7548620683
433 files changed
+61042
-27
No files matched your search
@@ -92,7 +92,7 @@ async def test_update_builtin_only_targets_builtins() -> None:
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_editable_or_raise_admin_can_edit_builtin() -> None:
|
||||
"""Route helper: admin gets edit access to built-ins; non-admin still 403."""
|
||||
"""Route helper: admin gets edit access to any agent; non-admin still 403."""
|
||||
from fastapi import HTTPException
|
||||
|
||||
from app.gateway.routers.agents import _get_editable_or_raise
|
||||
@@ -118,14 +118,16 @@ async def test_get_editable_or_raise_admin_can_edit_builtin() -> None:
|
||||
await _get_editable_or_raise(store, "builtin-agent", "user-a", is_admin=False)
|
||||
assert exc.value.status_code == 403
|
||||
|
||||
# Admin tries to edit someone else's PUBLISHED custom agent → still 403
|
||||
# (admin override only applies to built-ins, not to others' custom agents).
|
||||
# Admin edits someone else's custom agent → returns ('admin', record).
|
||||
# Behavior changed: admins manage the full agent catalog (built-in + any
|
||||
# user's agents), not just built-ins. Non-admins are still owner-only.
|
||||
await store.create(
|
||||
{"id": "published-other", "name": "Pub", "user_id": "user-x", "published": True}
|
||||
)
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
await _get_editable_or_raise(store, "published-other", "user-a", is_admin=True)
|
||||
assert exc.value.status_code == 403
|
||||
record, mode = await _get_editable_or_raise(
|
||||
store, "published-other", "user-a", is_admin=True
|
||||
)
|
||||
assert mode == "admin" and record["id"] == "published-other"
|
||||
|
||||
|
||||
def test_build_run_config_injects_custom_assistant_as_agent_id() -> None:
|
||||
|
||||
Reference in new issue
Block a user