Agent-Reach/tests/test_doctor.py
Panniantong 74c3df5c3d v2.0.0 — Pure glue architecture: zero copied code, pluggable channels
BREAKING: Complete architectural rewrite.

Before: Copied x-reader's fetcher code into readers/ (1205 lines of borrowed code)
After: Pluggable channel system where each channel is a thin wrapper (~50 lines)
       around the best external tool for that platform. Zero copied code.

Architecture:
- channels/base.py — Universal Channel interface (read, search, check)
- channels/web.py — Jina Reader API (swappable)
- channels/github.py — GitHub API (swappable)
- channels/twitter.py — birdx + Jina fallback (swappable)
- channels/youtube.py — yt-dlp (swappable)
- channels/reddit.py — Reddit JSON API + proxy (swappable)
- channels/rss.py — feedparser (swappable)
- channels/bilibili.py — Bilibili API (swappable)
- channels/exa_search.py — Exa semantic search (swappable)

Key design: every backend can be swapped by changing ONE file.
YouTube dies? Change youtube.py. Exa sucks? Swap exa_search.py for Tavily.
Nothing else changes.

Removed: reader.py, schema.py, readers/, search/, utils/ (all x-reader code)
Tests: 36/36 passing
2026-02-24 05:38:21 +01:00

36 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
"""Tests for doctor module."""
import pytest
from agent_eyes.config import Config
from agent_eyes.doctor import check_all, format_report
@pytest.fixture
def tmp_config(tmp_path):
return Config(config_path=tmp_path / "config.yaml")
class TestDoctor:
def test_zero_config_channels_ok(self, tmp_config):
results = check_all(tmp_config)
assert results["web"]["status"] == "ok"
assert results["github"]["status"] == "ok"
assert results["bilibili"]["status"] == "ok"
assert results["rss"]["status"] == "ok"
def test_exa_off_without_key(self, tmp_config):
results = check_all(tmp_config)
assert results["exa_search"]["status"] == "off"
def test_exa_on_with_key(self, tmp_config):
tmp_config.set("exa_api_key", "test-key")
results = check_all(tmp_config)
assert results["exa_search"]["status"] == "ok"
def test_format_report(self, tmp_config):
results = check_all(tmp_config)
report = format_report(results)
assert "Agent Eyes" in report
assert "" in report
assert "channels active" in report