feat: 完善日报人物来源与会议链接
This commit is contained in:
@ -7,6 +7,7 @@ from snooper_calendar import fetch_calendar_events
|
||||
class FakeCalendarClient:
|
||||
def __init__(self):
|
||||
self.calls = []
|
||||
self.native_urls = True
|
||||
|
||||
def api(self, name, data):
|
||||
self.calls.append((name, data))
|
||||
@ -31,19 +32,38 @@ class FakeCalendarClient:
|
||||
"summary": "合成早会",
|
||||
"locations": [{"name": "合成会议室 A"}],
|
||||
"isDeleted": False,
|
||||
"url": "https://example.com/a",
|
||||
"url": "https://example.com/a" if self.native_urls else "",
|
||||
},
|
||||
"event-b": {
|
||||
"summary": "合成下午会",
|
||||
"locations": [{"name": "合成会议室 B"}],
|
||||
"isDeleted": True,
|
||||
"meetingMinuteUrl": "https://example.com/minutes-b",
|
||||
"url": "https://example.com/event-b",
|
||||
"meetingMinuteUrl": (
|
||||
"https://example.com/minutes-b" if self.native_urls else ""
|
||||
),
|
||||
"url": "https://example.com/event-b" if self.native_urls else "",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
def test_manual_meeting_link_fills_missing_url_without_overriding_native():
|
||||
client = FakeCalendarClient()
|
||||
client.native_urls = False
|
||||
events = fetch_calendar_events(
|
||||
client,
|
||||
date(2026, 9, 9),
|
||||
ZoneInfo("Asia/Shanghai"),
|
||||
meeting_links={
|
||||
"2026-09-09|合成早会": "https://example.com/manual-a",
|
||||
"2026-09-09|合成下午会": "https://example.com/manual-b",
|
||||
},
|
||||
)
|
||||
|
||||
assert events[0]["url"] == "https://example.com/manual-a"
|
||||
assert events[1]["url"] == "https://example.com/manual-b"
|
||||
|
||||
|
||||
def test_fetch_calendar_events_normalizes_and_sorts_daily_instances():
|
||||
client = FakeCalendarClient()
|
||||
tz = ZoneInfo("Asia/Shanghai")
|
||||
|
||||
Reference in New Issue
Block a user