Fix custom instruction test typing

This commit is contained in:
adavyas 2026-03-14 13:12:58 -07:00
parent 6a746f1de4
commit f763f32b04
2 changed files with 11 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import signal
from datetime import datetime, timezone
from types import SimpleNamespace
from typing import Any
from unittest.mock import AsyncMock
@ -234,12 +233,14 @@ class TestCustomInstructions:
AsyncMock(),
)
message = SimpleNamespace(
message = models.Message(
id=1,
public_id="msg_1",
content="I like tea.",
created_at=datetime.now(timezone.utc),
peer_name="alice",
token_count=4,
seq_in_session=1,
session_name="session-1",
workspace_name="workspace-1",
)

View File

@ -1,12 +1,12 @@
from types import SimpleNamespace
from src import models
from src.schemas import MessageConfiguration, ReasoningConfiguration
from src.utils.config_helpers import get_configuration
class TestGetConfiguration:
def test_preserves_workspace_custom_instructions(self) -> None:
workspace = SimpleNamespace(
workspace = models.Workspace(
name="workspace-1",
configuration={
"reasoning": {
"enabled": True,
@ -21,10 +21,13 @@ class TestGetConfiguration:
assert config.reasoning.custom_instructions == "Focus on durable preferences."
def test_message_custom_instructions_override_session_and_workspace(self) -> None:
workspace = SimpleNamespace(
workspace = models.Workspace(
name="workspace-1",
configuration={"reasoning": {"custom_instructions": "workspace scope"}}
)
session = SimpleNamespace(
session = models.Session(
name="session-1",
workspace_name="workspace-1",
configuration={"reasoning": {"custom_instructions": "session scope"}}
)
message = MessageConfiguration(