test : add unit tests for _send_smtp_email_sync error handling

Đang mở
#2,250 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@taneesha-reyyi đang làm issue này rồi.

Từ ngày 30/7/2026.

  • #2255 của @tmdeveloper007 — đã đóng, không merge

Đánh giá

Issue này chưa được đánh giá.

Mô tả

Summary of What Needs to be Done:
Add unit tests for notification_service._send_smtp_email_sync in testing/backend/unit/test_smtp_notifications.py. This sync email helper has no direct unit tests despite handling critical notification delivery.

Changes that Need to be Made:
Add unit tests for _send_smtp_email_sync in testing/backend/unit/test_smtp_notifications.py (extend existing file):

For _send_smtp_email_sync(sender, recipients, subject, body, smtp_host, smtp_port):

  • raises ConnectionError when SMTP server is unreachable (mock socket.error)
  • raises TimeoutError when SMTP connection times out
  • successful send returns True with valid inputs
  • handles empty recipient list gracefully
  • handles missing subject or body (empty string is fine)
  • handles SMTP port as integer vs string

Impact that it would Provide:

  • Ensures critical notification path handles network failures gracefully
  • Improves reliability of email delivery for scan completion events
  • Pure function with no database dependencies

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

Ngôn ngữ chính
Python
Star
36
Fork
234
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của utksh1/SecuScan

Tất cả issue của utksh1/SecuScan

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.