def test_mail_name_socket(): check_value = "socket.blackhole.io" with mock.patch("os.access", return_value=False), mock.patch( "socket.getfqdn", return_value="socket.blackhole.io" ): mn = mailname() assert mn == check_value
def test_mail_name_file_garbage(): mnfile = create_file('mailname', ' \n ') check_value = 'socket.blackhole.io' with mock.patch('os.access', return_value=True), \ mock.patch('socket.getfqdn', return_value='socket.blackhole.io'): mn = mailname(mnfile) assert mn == check_value
def test_mail_name_file(): check_value = "file.blackhole.io" with mock.patch("os.access", return_value=True), mock.patch( "codecs.open", return_value=StringIO(check_value) ): mn = mailname() assert mn == check_value
def test_mail_name_file_garbage(): mnfile = create_file("mailname", " \n ") check_value = "socket.blackhole.io" with mock.patch("os.access", return_value=True), mock.patch( "socket.getfqdn", return_value="socket.blackhole.io"): mn = mailname(mnfile) assert mn == check_value
def test_mail_name_file_garbage(): mnfile = create_file("mailname", " \n ") check_value = "socket.blackhole.io" with mock.patch("os.access", return_value=True), mock.patch( "socket.getfqdn", return_value="socket.blackhole.io" ): mn = mailname(mnfile) assert mn == check_value
def __init__(self): """ Initialise the SMTP parotocol. .. note:: Loads the configuration, defines the server's FQDN and generates a RFC 2822 Message-ID. """ self.loop = asyncio.get_event_loop() super().__init__(asyncio.StreamReader(loop=self.loop), client_connected_cb=self._client_connected_cb, loop=self.loop) self.config = Config() self.fqdn = mailname() self.message_id = message_id()
def __init__(self, *args, **kwargs): """ Initialise the SMTP Protocol. .. note:: Loads the configuration, defines the server's FQDN and generates a RFC 2822 Message-ID. """ self.loop = asyncio.get_event_loop() super().__init__( asyncio.StreamReader(loop=self.loop), client_connected_cb=self._client_connected_cb, loop=self.loop) self.config = Config() self.fqdn = mailname() self.message_id = message_id()
def test_mail_name_socket(mock_os, mock_socket): check_value = 'socket.blackhole.io' mn = mailname() assert mn == check_value
def test_mail_name_file(mock_os): check_value = 'file.blackhole.io' with mock.patch('builtins.open', return_value=StringIO(check_value)): mn = mailname() assert mn == check_value
def test_mail_name_socket(): check_value = "socket.blackhole.io" with mock.patch("os.access", return_value=False), mock.patch( "socket.getfqdn", return_value="socket.blackhole.io"): mn = mailname() assert mn == check_value
def test_mail_name_file(): check_value = "file.blackhole.io" with mock.patch("os.access", return_value=True), mock.patch( "codecs.open", return_value=StringIO(check_value)): mn = mailname() assert mn == check_value
def test_mail_name_socket(): check_value = 'socket.blackhole.io' with mock.patch('os.access', return_value=False), \ mock.patch('socket.getfqdn', return_value='socket.blackhole.io'): mn = mailname() assert mn == check_value
def test_mail_name_file(): check_value = 'file.blackhole.io' with mock.patch('os.access', return_value=True), \ mock.patch('builtins.open', return_value=StringIO(check_value)): mn = mailname() assert mn == check_value