23 lines
805 B
Python
23 lines
805 B
Python
from app.core.config import Settings
|
|
from app.integrations.news_search_client import NewsSearchClient
|
|
|
|
|
|
def test_news_search_client_maps_article_to_candidate() -> None:
|
|
# 新闻搜索结果会先转为候选信号,再交给模型筛选成最终情报。
|
|
client = NewsSearchClient(Settings())
|
|
signal = client._article_to_signal(
|
|
{
|
|
"title": "AI agent platform launches",
|
|
"url": "https://example.com/ai-agent-platform",
|
|
"domain": "example.com",
|
|
"sourcecountry": "US",
|
|
"seendate": "20260708T120000Z",
|
|
}
|
|
)
|
|
|
|
assert signal is not None
|
|
assert signal.topic == "AI 新闻候选"
|
|
assert signal.source_name == "example.com"
|
|
assert signal.published_at is not None
|
|
assert signal.published_at.year == 2026
|