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

* bpo-39793: use same domain on make_msgid tests

* apply suggestions
This commit is contained in:
Batuhan Taşkaya 2020-04-16 20:29:12 +03:00 • committed by GitHub
parent 70f027dd22
commit 5565c30f0b
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 itertools import chain
from random import choice
from socket import getfqdn
from threading import Thread
from unittest.mock import patch
import email
import email.policy
@ -3342,9 +3342,11 @@ multipart/report
'.test-idstring@testdomain-string>')
def test_make_msgid_default_domain(self):
self.assertTrue(
email.utils.make_msgid().endswith(
'@' + getfqdn() + '>'))
with patch('socket.getfqdn') as mock_getfqdn:
mock_getfqdn.return_value = domain = 'pythontest.example.com'
self.assertTrue(
email.utils.make_msgid().endswith(
'@' + domain + '>'))
def test_Generator_linend(self):
# Issue 14645.

View file

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