def test__verify_port_hostname(self, mock_socket): mock_sock = mock.MagicMock() mock_socket.return_value = mock_sock console_utils._verify_port(10000, host='localhost.localdomain') mock_socket.assert_called_once_with() mock_sock.bind.assert_called_once_with( ('localhost.localdomain', 10000))
def test__verify_port_ipv6(self, mock_socket): mock_sock = mock.MagicMock() mock_socket.return_value = mock_sock console_utils._verify_port(10000, host='2001:dead:beef::1') mock_socket.assert_called_once_with(socket.AF_INET6) mock_sock.bind.assert_called_once_with(('2001:dead:beef::1', 10000))
def test__verify_port_ipv4(self, mock_socket): mock_sock = mock.MagicMock() mock_socket.return_value = mock_sock console_utils._verify_port(10000, host='1.2.3.4') mock_socket.assert_called_once_with() mock_sock.bind.assert_called_once_with(('1.2.3.4', 10000))