Files
wodify-cli/tests/test_cli.py
T
lucioandClaude Opus 5 8ab4ad4b17 fix: remove dead Home-variant GetClasses; classes now aliases schedule
The remaining open item. Probing settled it: the Home-variant GetClasses
returns placeholder records even when the real client calls it -- confirmed by
capturing the app's own request/response pair during a live walk (200, ~10 KB,
zero real records, empty ScheduleList). Every screen-variable override
(WBDataFetchIsComplete, IsLoading, ProgramsWithHistory, all date/program
combos) changes nothing. It is not parameter-gated; it is empty by design.

So the fix is honesty, not persistence: the action is removed from the
allowlist (a test pins it out so it cannot quietly return), and `wodify
classes` becomes an argparse alias of `schedule`, the class-list action that
actually returns data. `schedule` also gains the default-to-today behaviour
the old command had.

134 tests, no network required.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-07-25 15:44:41 -07:00

41 lines
1.2 KiB
Python

"""CLI wiring: the `classes` alias and command normalization."""
from __future__ import annotations
from wodify import cli
def test_classes_parses_as_alias_of_schedule():
args = cli.build_parser().parse_args(["classes", "--date", "2026-07-24"])
assert args.command == "classes"
assert args.date == "2026-07-24"
def test_main_normalizes_classes_to_schedule(monkeypatch):
seen = {}
def fake_query(args):
seen["command"] = args.command
seen["date"] = args.date
return 0
monkeypatch.setattr(cli, "cmd_query", fake_query)
assert cli.main(["classes"]) == 0
assert seen["command"] == "schedule"
assert seen["date"], "schedule should default to today"
def test_schedule_defaults_date_to_today(monkeypatch):
seen = {}
monkeypatch.setattr(cli, "cmd_query",
lambda a: seen.update(date=a.date) or 0)
cli.main(["schedule"])
assert seen["date"] == cli._today()
def test_explicit_date_not_overridden(monkeypatch):
seen = {}
monkeypatch.setattr(cli, "cmd_query",
lambda a: seen.update(date=a.date) or 0)
cli.main(["schedule", "--date", "2026-07-20"])
assert seen["date"] == "2026-07-20"