feat(calendar): timezone argument for events/tasks (IANA, default Europe/Berlin) for travel/foreign timezones

This commit is contained in:
Stefan Lohmaier committed 2026-10-01 09:29:31 +02:00
1 parent a73dbe8fdc
commit 5131f77a5c
4 files changed
+83 -21

No files matched your search

+33
View File
@@ -329,6 +329,39 @@ class TestCalendar:
except Exception:
pass
def test_event_timezone_hong_kong(self):
"""Auslands-Termin: timezone-Parameter verankert das Event in Asia/Hong_Kong (TZID + Offset)."""
token = get_token(self.PORT)
tag = f"McpHk-{int(time.time())}"
created = []
try:
r = tool_call(self.PORT, token, "create_event", {
"calendar": self.CAL1, "title": tag,
"start": "2026-11-05T18:00", "end": "2026-11-05T19:00",
"timezone": "Asia/Hong_Kong",
})
assert "erstellt" in r.lower() or "created" in r.lower(), f"create_event failed: {r}"
found = tool_call(self.PORT, token, "search_events",
{"query": tag, "date_from": "2026-11-01", "date_to": "2026-11-10"})
uids = _extract_uids(found)
assert uids, f"Keine UID: {found[:300]}"
created.append((self.CAL1, uids[0]))
assert re.search(r"T18:00:00\+08:00", found), (
f"HK-Termin nicht in +08:00 gespeichert: {found[:300]}")
# ungueltige Zeitzone -> sauberer Fehler statt Exception
bad = tool_call(self.PORT, token, "create_event", {
"calendar": self.CAL1, "title": f"{tag}-bad",
"start": "2026-11-05T18:00", "end": "2026-11-05T19:00",
"timezone": "Hongkong/Nope",
})
assert "unbekannte Zeitzone" in bad, f"ungueltige TZ nicht abgefangen: {bad}"
finally:
for cal, uid in created:
try:
tool_call(self.PORT, token, "delete_event", {"calendar": cal, "uid": uid})
except Exception:
pass
def test_create_event_second_calendar(self):
"""Event in zweitem Kalender anlegen (Wechsel/Mehrfach-Test)."""
token = get_token(self.PORT)