def test_is_safe_hostname(self, mock_getaddrinfo): mock_getaddrinfo.return_value = [(2, 1, 6, '', ('81.0.0.1', 0))] assert is_safe_hostname('example.com') is True mock_getaddrinfo.return_value = [(2, 1, 6, '', ('127.0.0.1', 0))] assert is_safe_hostname('example.com') is False
def test_is_safe_hostname(self, mock_getaddrinfo): mock_getaddrinfo.return_value = [(2, 1, 6, "", ("81.0.0.1", 0))] assert is_safe_hostname("example.com") is True mock_getaddrinfo.return_value = [(2, 1, 6, "", ("127.0.0.1", 0))] assert is_safe_hostname("example.com") is False