Skip to content

Commit

Permalink
tests: getaddrinfo(host, 0) is not supported on OpenIndiana platform
Browse files Browse the repository at this point in the history
  • Loading branch information
temoto committed Mar 27, 2023
1 parent 84f9c87 commit dd2f0ea
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/greendns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,14 +630,14 @@ def test_getaddrinfo_inet6(self):
def test_getaddrinfo_only_a_ans(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('example.com', '1.2.3.4')
res = greendns.getaddrinfo('example.com', 0)
res = greendns.getaddrinfo('example.com', None)
addr = [('1.2.3.4', 0)] * len(res)
assert addr == [ai[-1] for ai in res]

def test_getaddrinfo_only_aaaa_ans(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('example.com', 'dead:beef::1')
res = greendns.getaddrinfo('example.com', 0)
res = greendns.getaddrinfo('example.com', None)
addr = [('dead:beef::1', 0, 0, 0)] * len(res)
assert addr == [ai[-1] for ai in res]

Expand All @@ -654,7 +654,7 @@ def clear_raises(res_self):
res.raises = greendns.dns.exception.Timeout
greendns.resolver._resolver = res()

result = greendns.getaddrinfo('example.com', 0, 0)
result = greendns.getaddrinfo('example.com', None, 0)
addr = [('1.2.3.4', 0)] * len(result)
assert addr == [ai[-1] for ai in result]

Expand All @@ -671,7 +671,7 @@ def clear_raises(res_self):
res.raises = greendns.dns.exception.DNSException
greendns.resolver._resolver = res()

result = greendns.getaddrinfo('example.com', 0, 0)
result = greendns.getaddrinfo('example.com', None, 0)
addr = [('1.2.3.4', 0)] * len(result)
assert addr == [ai[-1] for ai in result]

Expand All @@ -691,7 +691,7 @@ def test_getaddrinfo_hosts_only_timeout(self):
greendns.resolver._resolver = res()

with tests.assert_raises(socket.gaierror):
greendns.getaddrinfo('example.com', 0, 0)
greendns.getaddrinfo('example.com', None, 0)

def test_getaddrinfo_hosts_only_dns_error(self):
hostsres = _make_mock_base_resolver()
Expand All @@ -702,13 +702,13 @@ def test_getaddrinfo_hosts_only_dns_error(self):
greendns.resolver._resolver = res()

with tests.assert_raises(socket.gaierror):
greendns.getaddrinfo('example.com', 0, 0)
greendns.getaddrinfo('example.com', None, 0)

def test_canonname(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('host.example.com', '1.2.3.4')
greendns.resolve_cname = self._make_mock_resolve_cname()
res = greendns.getaddrinfo('host.example.com', 0,
res = greendns.getaddrinfo('host.example.com', None,
0, 0, 0, socket.AI_CANONNAME)
assert res[0][3] == 'cname.example.com'

Expand Down

0 comments on commit dd2f0ea

Please sign in to comment.