Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

Fit the decision tests to main's room detail and merged workspace roles

agent-runner35331521e5b7ff7
diff --git a/core/tests/switch_core/gateway/test_caller_permissions.py b/core/tests/switch_core/gateway/test_caller_permissions.py
index cd0794b67..3561ce3d9 100644
--- a/core/tests/switch_core/gateway/test_caller_permissions.py
+++ b/core/tests/switch_core/gateway/test_caller_permissions.py
@@ -45,6 +45,7 @@ from tests.switch_core.gateway.agent_route_harness import (
add_user,
)
from tests.switch_core.gateway.test_room_detail_access import (
+ _NO_DECISIONS,
_ROOM_STORE,
_USER_STORE,
_add_room,
@@ -99,6 +100,7 @@ class TestRoomPermissions:
None, # type: ignore[arg-type] # bridge_store: the room has no bridge
None, # type: ignore[arg-type] # external_user_store
_protocol(),
+ _NO_DECISIONS,
user,
caller == "admin",
)
@@ -651,6 +653,7 @@ class TestRoomTransfer:
None, # type: ignore[arg-type] # bridge_store: the room has no bridge
None, # type: ignore[arg-type] # external_user_store
_protocol(),
+ _NO_DECISIONS,
owner,
False,
)
diff --git a/core/tests/switch_core/gateway/test_decision_settings.py b/core/tests/switch_core/gateway/test_decision_settings.py
index 358385e1a..492de5202 100644
--- a/core/tests/switch_core/gateway/test_decision_settings.py
+++ b/core/tests/switch_core/gateway/test_decision_settings.py
@@ -223,7 +223,7 @@ async def test_no_server_default_offers_no_haiku_and_says_why(
async def test_a_haiku_key_round_trips_as_its_last_four(
session_factory: async_sessionmaker[AsyncSession], service: _Service
) -> None:
- admin = await _person(session_factory, "ada", role="owner")
+ admin = await _person(session_factory, "ada", role="admin")
async with _as(_app(session_factory, service), admin) as client:
saved = await client.put(
"/decision-settings",
diff --git a/core/tests/switch_core/gateway/test_room_detail_access.py b/core/tests/switch_core/gateway/test_room_detail_access.py
index 3d7385cff..598c01ebf 100644
--- a/core/tests/switch_core/gateway/test_room_detail_access.py
+++ b/core/tests/switch_core/gateway/test_room_detail_access.py
@@ -16,6 +16,7 @@ from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker
from switch_core.bridges.resource.service import ResourceService
from switch_core.db.models import Room, User
from switch_core.db.stores.agent_store import AgentStore
+from switch_core.db.stores.decision_settings_store import DecisionSettingsStore
from switch_core.db.stores.document_store import DocumentStore
from switch_core.db.stores.package_store import PackageStore
from switch_core.db.stores.reference_store import ReferenceStore
@@ -24,6 +25,7 @@ from switch_core.db.stores.room_link_store import RoomLinkStore
from switch_core.db.stores.room_role_store import RoomRoleStore
from switch_core.db.stores.room_store import RoomStore
from switch_core.db.stores.user_store import UserStore
+from switch_core.decision.settings import DecisionAvailability, ServerDefault
from switch_core.gateway.rooms import get_room
_ROOM_STORE = RoomStore()
@@ -79,6 +81,13 @@ async def _add_room(
return room
+_NO_DECISIONS = DecisionAvailability(
+ enabled=False,
+ server=ServerDefault(endpoint_url=None, api_key=None, bedrock_enabled=False),
+ store=DecisionSettingsStore(),
+)
+
+
class TestRoomDetailOwner:
async def test_detail_names_the_owner(
self, session_factory: async_sessionmaker[AsyncSession]
@@ -94,6 +103,7 @@ class TestRoomDetailOwner:
None, # type: ignore[arg-type] # bridge_store: the room has no bridge
None, # type: ignore[arg-type] # external_user_store
_protocol(),
+ _NO_DECISIONS,
owner,
await _USER_STORE.administers(session, owner),
)