mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 13:53:15 +00:00
Applies the plan's C5 step: git mv every test per the domain-reorg
move-map (movemap-m50.txt) into tests/{agent,analyzer,auth,dashboard,
github,middleware,models,reviewer,sandbox,slack,tools,webhooks}/, plus
the 13 fork-only placements from the scoping report §2c (Atlassian
webhook tests -> tests/webhooks/, test_atlassian_connect.py and
test_auth_error_leak.py -> tests/auth/, jira/confluence util tests ->
tests/tools/, test_repo_binding_isolation.py -> tests/sandbox/,
bot-identity/autofix tests -> tests/github/).
Path-only move: the only content edits are parents[1] -> parents[2]
fixes in test_e2b_integration.py and test_daytona_integration.py,
required because their __file__-relative ROOT path gained one more
directory level in the move.
Monkeypatch retargets for these files were already completed in C4;
none remained outstanding here.
83 lines
2.7 KiB
Python
83 lines
2.7 KiB
Python
from __future__ import annotations
|
|
|
|
from unittest.mock import AsyncMock, patch
|
|
|
|
import pytest
|
|
from pydantic import ValidationError
|
|
|
|
from agent.dashboard.team_settings import (
|
|
TeamSettingsUpdate,
|
|
get_team_default_grouping_model,
|
|
)
|
|
|
|
_REVIEWER_SUBAGENT_PAIR = ("fireworks:accounts/fireworks/models/deepseek-v4-pro", "low")
|
|
_GROUPING_PAIR = ("fireworks:accounts/fireworks/models/kimi-k2p7-code", "low")
|
|
|
|
|
|
def _settings(**overrides: object) -> dict[str, object]:
|
|
base: dict[str, object] = {
|
|
"default_reviewer_subagent_model": _REVIEWER_SUBAGENT_PAIR[0],
|
|
"default_reviewer_subagent_reasoning_effort": _REVIEWER_SUBAGENT_PAIR[1],
|
|
"default_grouping_model": None,
|
|
"default_grouping_reasoning_effort": None,
|
|
}
|
|
base.update(overrides)
|
|
return base
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_grouping_inherits_reviewer_subagent_when_unset() -> None:
|
|
with patch(
|
|
"agent.dashboard.team_settings.get_team_settings",
|
|
new_callable=AsyncMock,
|
|
return_value=_settings(),
|
|
):
|
|
assert await get_team_default_grouping_model() == _REVIEWER_SUBAGENT_PAIR
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_grouping_uses_configured_model_when_set() -> None:
|
|
with patch(
|
|
"agent.dashboard.team_settings.get_team_settings",
|
|
new_callable=AsyncMock,
|
|
return_value=_settings(
|
|
default_grouping_model=_GROUPING_PAIR[0],
|
|
default_grouping_reasoning_effort=_GROUPING_PAIR[1],
|
|
),
|
|
):
|
|
assert await get_team_default_grouping_model() == _GROUPING_PAIR
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_grouping_inherits_when_configured_model_invalid() -> None:
|
|
with patch(
|
|
"agent.dashboard.team_settings.get_team_settings",
|
|
new_callable=AsyncMock,
|
|
return_value=_settings(
|
|
default_grouping_model="bogus:model",
|
|
default_grouping_reasoning_effort="high",
|
|
),
|
|
):
|
|
assert await get_team_default_grouping_model() == _REVIEWER_SUBAGENT_PAIR
|
|
|
|
|
|
def test_team_settings_update_accepts_grouping_pair() -> None:
|
|
update = TeamSettingsUpdate(
|
|
default_grouping_model=_GROUPING_PAIR[0],
|
|
default_grouping_reasoning_effort=_GROUPING_PAIR[1],
|
|
)
|
|
assert update.default_grouping_model == _GROUPING_PAIR[0]
|
|
assert update.default_grouping_reasoning_effort == _GROUPING_PAIR[1]
|
|
|
|
|
|
def test_team_settings_update_rejects_grouping_effort_without_model() -> None:
|
|
with pytest.raises(ValidationError):
|
|
TeamSettingsUpdate(default_grouping_reasoning_effort="high")
|
|
|
|
|
|
def test_team_settings_update_rejects_unsupported_grouping_effort() -> None:
|
|
with pytest.raises(ValidationError):
|
|
TeamSettingsUpdate(
|
|
default_grouping_model=_GROUPING_PAIR[0],
|
|
default_grouping_reasoning_effort="max",
|
|
)
|