File tree Expand file tree Collapse file tree 6 files changed +13
-6
lines changed
Expand file tree Collapse file tree 6 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ jobs:
1313 - uses : actions/checkout@v4
1414 - uses : actions/setup-python@v5
1515 with :
16- python-version : ' 3.7 '
16+ python-version : ' 3.11 '
1717 - name : Install dependencies
1818 run : |
1919 python -m pip install --upgrade pip
2020 pip install -r requirements.txt
2121 - name : test WebHook
2222 run : python test_webhook.py
2323 - name : test Digest
24- run : python test_digest.py
24+ run : python test_digest.py
Original file line number Diff line number Diff line change 1616from email .mime .text import MIMEText
1717from email .mime .multipart import MIMEMultipart
1818from email .header import Header
19- from email .utils import formataddr
19+ from email .utils import formataddr , make_msgid
2020from email .generator import Generator
2121import email .charset
2222from io import StringIO
@@ -756,8 +756,10 @@ def sendMail(
756756 msg ["From" ] = formataddr ((from_name , from_addr ))
757757 msg ["To" ] = "," .join (to_addr )
758758 msg ["Subject" ] = Header (subject )
759- if msgid :
760- msg ["Message-ID" ] = msgid
759+ if not msgid :
760+ msgid = make_msgid ()
761+ msg ["Message-ID" ] = msgid
762+
761763 if inreplyto :
762764 msg ["In-Reply-To" ] = inreplyto
763765
Original file line number Diff line number Diff line change 1414
1515config = {
1616 "SMTP_HOST" : "localhost" ,
17+ "SMTP_PORT" : "8080" ,
1718 "EMAIL_FROM" : "test@localhost" ,
1819 "TEMPLATES_DIR" : "tests/templates" ,
1920 "DIGEST_SENDER" :"W3C Webmaster via GitHub API" ,
Original file line number Diff line number Diff line change 88
99config = {
1010 "SMTP_HOST" : "localhost" ,
11+ "SMTP_PORT" : "8080" ,
1112 "EMAIL_FROM" : "test@localhost" ,
1213 "TEMPLATES_DIR" : "tests/templates" ,
1314 "GH_OAUTH_TOKEN" : "foo" ,
Original file line number Diff line number Diff line change 11from mock import patch , call
22import email
3+ import email .utils
34import unittest
45import smtplib
56import json
@@ -42,8 +43,9 @@ def test_ip_check_403(self):
4243 )
4344 assert rv .status_code == 403
4445
46+ @patch ("index.make_msgid" , return_value = "<test@example.com>" )
4547 @patch ("smtplib.SMTP" , autospec = True )
46- def test_w3c_tr_published (self , mock_smtp ):
48+ def test_w3c_tr_published (self , mock_smtp , mock_make_msgid ):
4749 data = self .read_file ("tests/trpublished-notif.json" )
4850 rv = requests .post (
4951 "http://localhost:8000/" ,
Original file line number Diff line number Diff line change @@ -4,5 +4,6 @@ Content-Type: text/plain; charset="utf-8"; format="flowed"
44From: W3C Webmaster via W3C API <test@localhost>
55To: dom@localhost
66Subject: "SHACL Use Cases and Requirements" published as a Working Draft
7+ Message-ID: <test@example.com>
78
89"SHACL Use Cases and Requirements" has just been published as a W3C Working Draft dated 2016-01-22 at http://www.w3.org/TR/2016/WD-shacl-ucr-20160122/.
You can’t perform that action at this time.
0 commit comments