bpo-39793: use the same domain on make_msgid tests (GH-18698) (GH-19554)

(cherry picked from commit 5565c30f0b)

Co-authored-by: Batuhan Taşkaya <batuhanosmantaskaya@gmail.com>
This commit is contained in:
Miss Islington (bot) 2020-04-16 11:07:52 -07:00 committed by GitHub
parent 3e72de9e08
commit ccf30e96d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 4 deletions

View File

@ -11,8 +11,8 @@ import textwrap
from io import StringIO, BytesIO from io import StringIO, BytesIO
from itertools import chain from itertools import chain
from random import choice from random import choice
from socket import getfqdn
from threading import Thread from threading import Thread
from unittest.mock import patch
import email import email
import email.policy import email.policy
@ -3342,9 +3342,11 @@ multipart/report
'.test-idstring@testdomain-string>') '.test-idstring@testdomain-string>')
def test_make_msgid_default_domain(self): def test_make_msgid_default_domain(self):
with patch('socket.getfqdn') as mock_getfqdn:
mock_getfqdn.return_value = domain = 'pythontest.example.com'
self.assertTrue( self.assertTrue(
email.utils.make_msgid().endswith( email.utils.make_msgid().endswith(
'@' + getfqdn() + '>')) '@' + domain + '>'))
def test_Generator_linend(self): def test_Generator_linend(self):
# Issue 14645. # Issue 14645.

View File

@ -0,0 +1 @@
Use the same domain when testing ``make_msgid``. Patch by Batuhan Taskaya.