29 lines
1.1 KiB
Python
29 lines
1.1 KiB
Python
from app.core.config import Settings
|
|
from app.integrations.github_client import GitHubHotProjectClient
|
|
|
|
|
|
def test_github_client_maps_repository_to_signal() -> None:
|
|
# GitHub仓库候选先标准化为信号,再交给模型做最终筛选。
|
|
client = GitHubHotProjectClient(Settings())
|
|
signal = client._to_signal_item(
|
|
{
|
|
"full_name": "example/agent-kit",
|
|
"description": "Agent framework for production workflows.",
|
|
"html_url": "https://github.com/example/agent-kit",
|
|
"stargazers_count": 2400,
|
|
"forks_count": 180,
|
|
"language": "Python",
|
|
"created_at": "2026-05-01T09:00:00Z",
|
|
"pushed_at": "2026-05-07T10:00:00Z",
|
|
}
|
|
)
|
|
|
|
assert signal.topic == "GitHub 热门项目"
|
|
assert signal.source_type == "github"
|
|
assert signal.source_name == "GitHub"
|
|
assert signal.source_url == "https://github.com/example/agent-kit"
|
|
assert "2400 stars" in signal.summary
|
|
assert "2026-05-01" in signal.summary
|
|
assert signal.published_at is not None
|
|
assert signal.published_at.hour == 17
|