This repository has been archived on 2026-03-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Timmy-time-dashboard/tests/timmy/test_tools_delegation.py
Trip T 0e89caa830 test: update delegation tests for YAML-driven agent IDs
Old hardcoded IDs (seer, forge, echo, helm, quill) replaced with
YAML-defined IDs (orchestrator, researcher, coder, writer, memory,
experimenter). Added test that old names are explicitly rejected.
2026-03-14 08:40:24 -04:00

53 lines
2.1 KiB
Python

"""Tests for timmy.tools_delegation — delegate_task and list_swarm_agents.
Agent IDs are now defined in config/agents.yaml, not hardcoded Python.
Tests reference the YAML-defined IDs: orchestrator, researcher, coder,
writer, memory, experimenter.
"""
from timmy.tools_delegation import delegate_task, list_swarm_agents
class TestDelegateTask:
def test_unknown_agent_returns_error(self):
result = delegate_task("nonexistent", "do something")
assert result["success"] is False
assert "Unknown agent" in result["error"]
assert result["task_id"] is None
def test_valid_agent_names_normalised(self):
# Agent IDs are lowercased; whitespace should be stripped
result = delegate_task(" Researcher ", "think about it")
assert "Unknown agent" not in result.get("error", "")
def test_invalid_priority_defaults_to_normal(self):
# Even with bad priority, delegate_task should not crash
result = delegate_task("coder", "build", priority="ultra")
assert isinstance(result, dict)
def test_all_valid_agents_accepted(self):
# These IDs match config/agents.yaml
valid_agents = ["orchestrator", "researcher", "coder", "writer", "memory", "experimenter"]
for agent in valid_agents:
result = delegate_task(agent, "test task")
assert "Unknown agent" not in result.get("error", ""), f"{agent} rejected"
def test_old_agent_names_no_longer_valid(self):
# Old hardcoded names should not work anymore
for old_name in ["seer", "forge", "echo", "helm", "quill", "mace"]:
result = delegate_task(old_name, "test")
assert result["success"] is False
assert "Unknown agent" in result["error"]
class TestListSwarmAgents:
def test_returns_agents_from_yaml(self):
result = list_swarm_agents()
assert result["success"] is True
assert len(result["agents"]) > 0
agent_names = [a["name"] for a in result["agents"]]
# These names come from config/agents.yaml
assert "Seer" in agent_names
assert "Forge" in agent_names
assert "Timmy" in agent_names