furtka/tests
Daniel Maksymilian Syrnicki 5c58eade1c feat(furtka): Furtka-updates card on /settings + API endpoints
Slice 3 of the self-update story, the user-facing piece. The existing
CLI update flow now has a button next to it.

API additions (furtka/api.py):
- POST /api/furtka/update/check — thin wrapper around updater.check_update
- POST /api/furtka/update/apply — pre-checks the lockfile (409 on conflict)
  then kicks the updater off via systemd-run as a detached transient unit,
  so the update outlives the furtka-api restart it triggers. Returns 202
  with the unit name.
- GET  /api/furtka/update/status — returns the current update-state.json

UI additions (furtka/assets/www/settings/index.html):
- New "Furtka updates" card above Appearance showing installed +
  latest-available versions with Check + Update buttons.
- On apply: starts polling /update-state.json every 2s. That file is
  Caddy-served (not API-served) so the mid-update API restart doesn't
  interrupt progress reporting. Stage labels get plain-English strings
  (Downloading release… / Verifying signature… / etc.). On done: 5s
  grace, then location.reload() so the user sees the new version live.
  On rolled_back: red status with the reason string.

Tests (tests/test_api.py):
- 5 new tests covering both endpoint return shapes (success, 502 when
  updater.check_update raises, 409 when lock held, 202 on dispatch,
  status passthrough).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 13:44:34 +02:00
..
test_api.py feat(furtka): Furtka-updates card on /settings + API endpoints 2026-04-16 13:44:34 +02:00
test_app.py feat(furtka): serve from /opt/furtka/current, retire /srv/furtka/www/ 2026-04-16 13:15:59 +02:00
test_cli.py feat(furtka): reconciler + install/remove — slice 2 2026-04-15 10:02:00 +02:00
test_drives.py feat(webinstaller): plain-English drive picker on step 2 2026-04-16 12:01:57 +02:00
test_installer.py feat(furtka): in-browser app settings + ISO recovery-path fixes 2026-04-15 13:00:02 +02:00
test_manifest.py feat(furtka): in-browser app settings + ISO recovery-path fixes 2026-04-15 13:00:02 +02:00
test_reconciler.py fix(furtka): audit follow-ups — placeholder secrets, isolate reconcile, .env perms 2026-04-15 10:17:00 +02:00
test_scanner.py feat(furtka): resource-manager skeleton — manifest, scanner, CLI 2026-04-15 09:59:41 +02:00
test_updater.py feat(furtka): release CI + \furtka update\ / \furtka rollback\ CLI 2026-04-16 13:30:45 +02:00
test_webinstaller_assets.py feat(furtka): release CI + \furtka update\ / \furtka rollback\ CLI 2026-04-16 13:30:45 +02:00