birdcage/mcp/tests/test_signal.py
Ryan Malloy 8a6b99bd8c Add birdcage-mcp FastMCP server for satellite dish control
34 tools (connection, movement, signal, system, satellite, console),
5 resources, 3 prompts. Backed by DemoDevice for offline testing.
46 tests passing against the demo backend via run_server_async.
2026-02-17 16:01:51 -07:00

81 lines
2.2 KiB
Python

"""Tests for signal measurement tools."""
import pytest
from conftest import parse_result
from fastmcp import Client
@pytest.mark.anyio
async def test_get_rssi_default(mcp_client: Client):
result = await mcp_client.call_tool("get_rssi", {})
data = parse_result(result)
assert data["reads"] == 10
assert isinstance(data["average"], int)
assert isinstance(data["current"], int)
@pytest.mark.anyio
async def test_get_rssi_custom_iterations(mcp_client: Client):
result = await mcp_client.call_tool("get_rssi", {"iterations": 5})
data = parse_result(result)
assert data["reads"] == 5
@pytest.mark.anyio
async def test_get_adc_rssi(mcp_client: Client):
result = await mcp_client.call_tool("get_adc_rssi", {})
data = parse_result(result)
assert "raw" in data
@pytest.mark.anyio
async def test_get_lock_status(mcp_client: Client):
result = await mcp_client.call_tool("get_lock_status", {})
data = parse_result(result)
assert "raw" in data
assert "Lock:" in data["raw"]
@pytest.mark.anyio
async def test_enable_lna(mcp_client: Client):
result = await mcp_client.call_tool("enable_lna", {})
data = parse_result(result)
assert data["status"] == "lna_enabled"
assert data["voltage"] == "13V"
@pytest.mark.anyio
async def test_get_dvb_config(mcp_client: Client):
result = await mcp_client.call_tool("get_dvb_config", {})
data = parse_result(result)
assert "BCM" in data["raw"]
assert "0x4515" in data["raw"]
@pytest.mark.anyio
async def test_get_channel_params(mcp_client: Client):
result = await mcp_client.call_tool("get_channel_params", {})
data = parse_result(result)
assert "Frequency" in data["raw"]
@pytest.mark.anyio
async def test_az_sweep(mcp_client: Client):
result = await mcp_client.call_tool(
"az_sweep",
{
"start_az": 195.0,
"span": 10.0,
"step_cdeg": 200,
"num_xponders": 1,
},
)
data = parse_result(result)
assert data["count"] > 0
assert len(data["points"]) == data["count"]
pt = data["points"][0]
assert "az" in pt
assert "rssi" in pt
assert "lock" in pt
assert "snr" in pt