2026-06-03 08:11:17 +03:00
|
|
|
from types import SimpleNamespace
|
|
|
|
|
|
2026-06-04 15:44:25 +01:00
|
|
|
from tests.helpers.cli_loader import load_script
|
|
|
|
|
from tests.helpers.db_stubs import make_core_db_stub
|
2026-06-03 08:11:17 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_calendar_name_handles_missing_relation(monkeypatch):
|
2026-06-04 15:44:25 +01:00
|
|
|
make_core_db_stub(monkeypatch, models=["CalendarCal", "CalendarEvent"])
|
|
|
|
|
cli = load_script("odysseus-calendar")
|
2026-06-03 08:11:17 +03:00
|
|
|
|
|
|
|
|
assert cli._calendar_name(SimpleNamespace(calendar=None)) == ""
|
|
|
|
|
assert cli._calendar_name(SimpleNamespace(calendar=SimpleNamespace(name=123))) == ""
|
|
|
|
|
assert cli._calendar_name(SimpleNamespace(calendar=SimpleNamespace(name="Work"))) == "Work"
|