thermograph/tests
Emi Griffith 41e84060ab Link a Thermograph account to Discord via OAuth2 (#208)
Lets a signed-in user connect their Discord account (OAuth2 identify), storing the
Discord user id that a later feature (DM alerts) will deliver to. Standard
authorization-code flow, all server-side:

- backend/discord_link.py: /discord/link/start redirects to Discord's consent
  screen; /discord/link/callback exchanges the code, reads the Discord user id, and
  stores it; /discord/unlink forgets it. The `state` is signed with the app auth
  secret (stdlib hmac, no new dependency) and carries the Thermograph user id, so a
  callback can't be replayed or bound to another account. Every route requires an
  active session, so linking acts on whoever is actually logged in.
- models.py: User.discord_id (unique, nullable). schemas.py exposes it on UserRead
  so the frontend can show link state.
- app.py: the router under /api/v2/discord.
- account.js: a "Link Discord" / "Unlink Discord" control in the account popover.
- deploy/migrations/001-user-discord-id.sql: the manual column add for the existing
  prod accounts DB. This project has no Alembic — create_all only makes missing
  tables, so an added column needs a hand-applied migration (documented in-file).
- env example: THERMOGRAPH_DISCORD_CLIENT_SECRET + the redirect to register.

Claude-Session: https://claude.ai/code/session_013dRZmX9D3JEntfMKWMTWZ8
2026-07-20 02:26:33 +00:00
..
conftest.py Isolate the access log in tests so self-test traffic doesn't pollute the live monitor (#168) 2026-07-17 19:44:30 +00:00
test_api.py Add a climate-score page from recent-vs-baseline percentile divergence (#196) 2026-07-19 23:02:33 +00:00
test_api_accounts.py Push: surface delivery failures (no longer a silent success) (#157) 2026-07-17 00:12:14 +00:00
test_climate.py Add a climate-score page from recent-vs-baseline percentile divergence (#196) 2026-07-19 23:02:33 +00:00
test_content.py Report rain in whole millimetres; lift tier spans out of the bars (#192) 2026-07-19 19:28:58 +00:00
test_dashboard.py Report the notifier's health by heartbeat, not per-worker threads (#166) 2026-07-17 13:49:30 +00:00
test_digest.py Hide footer email digest signup for now (#194) 2026-07-19 22:26:47 +00:00
test_discord.py Post the daily "most unusual right now" feed to Discord (#205) 2026-07-20 00:48:22 +00:00
test_discord_interactions.py Serve a /grade Discord slash command over HTTP interactions (#207) 2026-07-20 02:19:29 +00:00
test_discord_link.py Link a Thermograph account to Discord via OAuth2 (#208) 2026-07-20 02:26:33 +00:00
test_grading.py Migrate backend dataframe layer from pandas to polars (#90) 2026-07-15 19:07:38 +00:00
test_grid.py Warm neighbor cells server-side (/cell?neighbors=1) (#51) 2026-07-11 20:47:31 +00:00
test_homepage.py Stop the records strip showing stale readings as "right now" (#185) 2026-07-18 08:58:34 +00:00
test_metrics.py Rebuild the homepage as a distribution landing; add an SMTP seam (#178) 2026-07-18 07:39:47 +00:00
test_notify.py Add PWA + Web Push delivery for weather alerts (#95) 2026-07-15 23:21:06 +00:00
test_places.py Move the suggestion policy into places.py (#45) 2026-07-11 20:00:24 +00:00
test_scoring.py Clarify wet bulb, add heat-stress-day share, frame total as net change (#197) 2026-07-19 23:37:42 +00:00
test_singleton.py Gate the subscription notifier to one worker (#161) 2026-07-17 12:54:55 +00:00
test_store.py Compare/calendar mobile polish: overflow fix, sheet load button, 6-yr default, country in names (#80) 2026-07-12 06:32:10 +00:00
test_views.py Add a climate-score page from recent-vs-baseline percentile divergence (#196) 2026-07-19 23:02:33 +00:00