Skip to content

test: add offline alert service tests for billing alerts and digests - #508

Open
Felamsy wants to merge 3 commits into
AyinkxLab:mainfrom
Felamsy:fix/issue-475-phase-10-alert-service-tests
Open

Felamsy wants to merge 3 commits into
AyinkxLab:mainfrom
Felamsy:fix/issue-475-phase-10-alert-service-tests

Conversation

@Felamsy

@Felamsy Felamsy commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Overview

This PR adds offline test coverage for billing alerts and digests, covering thresholds, dedupe, notification preferences, and email fallback. Supporting changes in the notification and email services and the notification preference model make the alert behavior testable without network access.

Related Issue

Changes

🔔 Alert Service Tests

  • [ADD] tests/test_alerts.py

    • Covers threshold triggering for billing alerts.
    • Covers dedupe behavior so repeated alerts are not re-sent.
    • Covers notification preference handling.
    • Covers email fallback path.
    • Runs fully offline (no live email or network calls).
  • [MODIFY] app/services/notifications.py

    • Adjustments needed to support threshold, dedupe, and preference behavior under test.
  • [MODIFY] app/services/email.py

    • Adjustments needed to support the email fallback path offline.
  • [MODIFY] app/models/notification_preference.py

    • Adjustments needed to support preference handling in alert tests.

Verification Results

ruff check .
black --check .
pytest
Acceptance Criteria Status
Alert behavior is fully covered ✅ Thresholds, dedupe, preferences, and email fallback covered in tests/test_alerts.py
The suite runs offline ✅ Tests avoid live network/email calls
ruff check ., black --check . and pytest stay green ✅ Lint, format, and test suite pass

Closes #475

@Felamsy

Felamsy commented Oct 18, 2026

Copy link
Copy Markdown
Contributor Author

this PR is ready for another review. I resolved the merge conflicts with the main branch (pushed 70c16d9).
Files changed: app/services/email.py, tests/test_alerts.py

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.

Phase 10: Alert service tests

1 participant