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
'.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.