Plugin: update tests #15

Closed
opened 2026-08-09 20:31:47 +00:00 by hermes · 1 comment
Owner

Context

Plugin rework (see #18). Tests need to track the config and client
changes from #13/#14.

Task

In /opt/data/git/git.sams.wtf/coop/beets-appleplaylists/tests/:

  • test_apple_api.py: FakeSession asserting gateway URLs
    ({service}/api/v1/playlists, /playlists/{id}/tracks), bearer header,
    401 -> AppleAPIError with the re-login hint.
  • test_plugin.py: new config defaults (service_url/service_token,
    env fallbacks); command registration unchanged.
  • New: login/status/logout behaviour with a mocked gateway session
    (polling loop, status output, logout DELETE).
  • Remove anything referencing the old auth stack (there were no auth tests,
    but check imports in the plugin fixture).

Acceptance criteria

  • uv run pytest green; coverage of the reworked paths exists; no test
    touches the network or the real beets config.
## Context Plugin rework (see #18). Tests need to track the config and client changes from #13/#14. ## Task In `/opt/data/git/git.sams.wtf/coop/beets-appleplaylists/tests/`: - `test_apple_api.py`: FakeSession asserting gateway URLs (`{service}/api/v1/playlists`, `/playlists/{id}/tracks`), bearer header, 401 -> AppleAPIError with the re-login hint. - `test_plugin.py`: new config defaults (`service_url`/`service_token`, env fallbacks); command registration unchanged. - New: login/status/logout behaviour with a mocked gateway session (polling loop, status output, logout DELETE). - Remove anything referencing the old auth stack (there were no auth tests, but check imports in the plugin fixture). ## Acceptance criteria - `uv run pytest` green; coverage of the reworked paths exists; no test touches the network or the real beets config.
Author
Owner

Implemented in coop/beets-appleplaylists commit b5a121c8c728bcf218e5e4561bed603e01e82b44. Tests now use gateway FakeSession/FakeResponse doubles, assert the gateway URLs and bearer header, cover 401/403 and network errors, verify config defaults/env fallbacks, and cover login polling, status output, logout DELETE, and missing-config errors.

Verification: uv run pytest -q -> 21 passed; no test contacts the network or the real beets config.

Implemented in `coop/beets-appleplaylists` commit `b5a121c8c728bcf218e5e4561bed603e01e82b44`. Tests now use gateway `FakeSession`/`FakeResponse` doubles, assert the gateway URLs and bearer header, cover 401/403 and network errors, verify config defaults/env fallbacks, and cover login polling, status output, logout DELETE, and missing-config errors. Verification: `uv run pytest -q` -> 21 passed; no test contacts the network or the real beets config.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coop/beets-appleplaylists#15
No description provided.