41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
from beaver.engine import AgentLoop
|
|
from beaver.foundation.events import InboundMessage, MessageBus, OutboundMessage
|
|
from beaver.interfaces.gateway.main import run_gateway
|
|
from beaver.interfaces.web.app import create_app
|
|
from beaver.interfaces.web.schemas import WebChatRequest, WebChatResponse
|
|
|
|
|
|
def test_agent_loop_boots() -> None:
|
|
loop = AgentLoop()
|
|
loaded = loop.boot()
|
|
assert "echo" in loaded.tools
|
|
assert "memory" in loaded.tools
|
|
assert "session_search" in loaded.tools
|
|
|
|
|
|
def test_web_app_factory() -> None:
|
|
app = create_app()
|
|
assert app.title == "Beaver Backend"
|
|
|
|
|
|
def test_gateway_entry_imports() -> None:
|
|
assert callable(run_gateway)
|
|
|
|
|
|
def test_message_bus_imports() -> None:
|
|
bus = MessageBus()
|
|
assert isinstance(bus, MessageBus)
|
|
assert InboundMessage(channel="test", content="hello").channel == "test"
|
|
assert OutboundMessage(channel="test", content="ok", session_id=None, finish_reason="stop").content == "ok"
|
|
|
|
|
|
def test_web_schema_imports() -> None:
|
|
assert WebChatRequest(message="hello").message == "hello"
|
|
assert WebChatResponse(
|
|
session_id="s",
|
|
run_id="r",
|
|
output_text="ok",
|
|
finish_reason="stop",
|
|
tool_iterations=0,
|
|
).output_text == "ok"
|