Skip to content

test: cover saving notification settings, the Telegram poller and Send test - #72

Merged
FMSMITH91 merged 1 commit into
mainfrom
test/notification-settings-and-poller
Aug 9, 2026
Merged

test: cover saving notification settings, the Telegram poller and Send test#72
FMSMITH91 merged 1 commit into
mainfrom
test/notification-settings-and-poller

Conversation

@FMSMITH91

Copy link
Copy Markdown
Owner

The rest of notifications.py's zero-coverage functions.

The one that matters

save_settings treats a None secret as "keep what's stored", because the settings form never round-trips a real token back to the server. If that ever broke, every unrelated checkbox change would silently wipe the bot token — and alerts would just stop, with no error and nothing on screen.

Asserted both directions: None keeps the stored value, a real value replaces it and is written encrypted (plaintext must not appear in the config, and it must decrypt back).

Also covered

  • Thresholds clamp to their bounds rather than storing whatever was posted, and junk in a numeric field is ignored instead of overwriting a good value
  • The Telegram poller returns None for a malformed or empty token without building a URL
  • Send test explains what's missing — five cases, each naming the field — rather than failing mute

On safety

update_config is stubbed throughout, so the real data/config.json is never written by these. Verified: the file's bytes are unchanged across a run.

Its mtime does move, but that predates this change — I checked, and the suite already rewrote it byte-identically at HEAD. Not introduced here, and harmless, but worth knowing.

Mutation-verified:

None token overwrites instead of keeping -> 1 fail
secrets stored in the clear              -> 1 fail
thresholds no longer clamped             -> 1 fail

unit 854 → 867 · lint clean.

🤖 Generated with Claude Code

…d test

The rest of notifications.py's zero-coverage functions. The one that matters:

save_settings treats a None secret as "keep what is stored", because the
settings form never round-trips a real token back to the server. If that ever
broke, every unrelated checkbox change would silently wipe the bot token and
alerts would just stop — no error, nothing on screen. Asserted in both
directions: None keeps the stored value, a real value replaces it AND is
written encrypted (the plaintext must not appear in the config, and it must
decrypt back).

Also: thresholds clamp to their bounds rather than storing whatever was
posted, and junk in a numeric field is ignored instead of overwriting a good
value; the Telegram poller returns None for a malformed or empty token
without building a URL; and Send test explains what is missing — five cases,
each naming the field — rather than failing mute.

update_config is stubbed throughout, so the real data/config.json is never
written by these. Verified: the file's bytes are unchanged across a run. (Its
mtime does move, but that predates this change — the suite already rewrote it
byte-identically at HEAD.)

Mutation-verified: making a None token overwrite fails 1, storing the secret
in the clear fails 1, dropping the threshold clamp fails 1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codacy-production

codacy-production Bot commented Aug 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Coverage ∅ diff coverage · +0.38% coverage variation

Metric Results
Coverage variation +0.38% coverage variation (-1.00%)
Diff coverage diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (0b52813) 11965 5823 48.67%
Head commit (d73721b) 11965 (+0) 5869 (+46) 49.05% (+0.38%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#72) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@FMSMITH91
FMSMITH91 merged commit 74d11e8 into main Aug 9, 2026
19 checks passed
@FMSMITH91
FMSMITH91 deleted the test/notification-settings-and-poller branch August 9, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant