test : add unit tests for _send_smtp_email_sync error handling

オープン
#2,250 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@taneesha-reyyi がすでに取り組んでいます。

2026年7月30日 から。

  • #2255 @tmdeveloper007 による — マージされずにクローズ

評価

この issue はまだ評価されていません。

説明

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.

主要言語
Python
スター
36
フォーク
234
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

utksh1/SecuScan のほかの issue

utksh1/SecuScan の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。