示例#1
0
 def test_bind_ipv6(self):
     self._resources.enter_context(patch('aiosmtpd.main.socket.socket'))
     mock_sock = setup_sock('::1', 8025)
     self.assertEqual(mock_sock.setsockopt.call_args_list, [
         call(socket.SOL_SOCKET, socket.SO_REUSEADDR, True),
         call(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, False),
     ])
示例#2
0
 def test_bind_ipv6(self):
     self._resources.enter_context(patch('aiosmtpd.main.socket.socket'))
     mock_sock = setup_sock('::1', 8025)
     self.assertEqual(mock_sock.setsockopt.call_args_list, [
         call(socket.SOL_SOCKET, socket.SO_REUSEADDR, True),
         call(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, False),
         ])
示例#3
0
 def test_bind_ipv4(self):
     self._resources.enter_context(patch('aiosmtpd.main.socket.socket'))
     mock_sock = setup_sock('host.example.com', 8025)
     mock_sock.setsockopt.assert_called_once_with(socket.SOL_SOCKET,
                                                  socket.SO_REUSEADDR, True)
示例#4
0
 def test_ipv6(self):
     bind = self._resources.enter_context(patch('aiosmtpd.main.bind'))
     mock_sock = setup_sock('::1', 8025)
     bind.assert_called_once_with(socket.AF_INET6, socket.SOCK_STREAM, 0)
     mock_sock.bind.assert_called_once_with(('::1', 8025, 0, 0))
示例#5
0
 def test_ipv4(self):
     bind = self._resources.enter_context(patch('aiosmtpd.main.bind'))
     mock_sock = setup_sock('host.example.com', 8025)
     bind.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM, 0)
     mock_sock.bind.assert_called_once_with(('host.example.com', 8025))
示例#6
0
 def test_bind_ipv4(self):
     self._resources.enter_context(patch('aiosmtpd.main.socket.socket'))
     mock_sock = setup_sock('host.example.com', 8025)
     mock_sock.setsockopt.assert_called_once_with(
         socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
示例#7
0
 def test_ipv6(self):
     bind = self._resources.enter_context(patch('aiosmtpd.main.bind'))
     mock_sock = setup_sock('::1', 8025)
     bind.assert_called_once_with(socket.AF_INET6, socket.SOCK_STREAM, 0)
     mock_sock.bind.assert_called_once_with(('::1', 8025, 0, 0))
示例#8
0
 def test_ipv4(self):
     bind = self._resources.enter_context(patch('aiosmtpd.main.bind'))
     mock_sock = setup_sock('host.example.com', 8025)
     bind.assert_called_once_with(socket.AF_INET, socket.SOCK_STREAM, 0)
     mock_sock.bind.assert_called_once_with(('host.example.com', 8025))