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), ])
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)
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))
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))
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)