Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed tests.greendns_test.TestGetaddrinfo #375

Merged
merged 1 commit into from
Jan 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions tests/greendns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,11 @@ def test_getaddrinfo(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('example.com', '127.0.0.2')
greendns.resolve.add('example.com', '::1')
res = greendns.getaddrinfo('example.com', 'ssh')
addr = ('127.0.0.2', 22)
res = greendns.getaddrinfo('example.com', 'domain')
addr = ('127.0.0.2', 53)
tcp = (socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP, addr)
udp = (socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP, addr)
addr = ('::1', 22, 0, 0)
addr = ('::1', 53, 0, 0)
tcp6 = (socket.AF_INET6, socket.SOCK_STREAM, socket.IPPROTO_TCP, addr)
udp6 = (socket.AF_INET6, socket.SOCK_DGRAM, socket.IPPROTO_UDP, addr)
filt_res = [ai[:3] + (ai[4],) for ai in res]
Expand All @@ -475,8 +475,8 @@ def test_getaddrinfo_idn(self):
greendns.resolve = _make_mock_resolve()
idn_name = u'евентлет.com'
greendns.resolve.add(idn_name.encode('idna').decode('ascii'), '127.0.0.2')
res = greendns.getaddrinfo(idn_name, 'ssh')
addr = ('127.0.0.2', 22)
res = greendns.getaddrinfo(idn_name, 'domain')
addr = ('127.0.0.2', 53)
tcp = (socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP, addr)
udp = (socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP, addr)
filt_res = [ai[:3] + (ai[4],) for ai in res]
Expand All @@ -486,8 +486,8 @@ def test_getaddrinfo_idn(self):
def test_getaddrinfo_inet(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('example.com', '127.0.0.2')
res = greendns.getaddrinfo('example.com', 'ssh', socket.AF_INET)
addr = ('127.0.0.2', 22)
res = greendns.getaddrinfo('example.com', 'domain', socket.AF_INET)
addr = ('127.0.0.2', 53)
tcp = (socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP, addr)
udp = (socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP, addr)
assert tcp in [ai[:3] + (ai[4],) for ai in res]
Expand All @@ -496,8 +496,8 @@ def test_getaddrinfo_inet(self):
def test_getaddrinfo_inet6(self):
greendns.resolve = _make_mock_resolve()
greendns.resolve.add('example.com', '::1')
res = greendns.getaddrinfo('example.com', 'ssh', socket.AF_INET6)
addr = ('::1', 22, 0, 0)
res = greendns.getaddrinfo('example.com', 'domain', socket.AF_INET6)
addr = ('::1', 53, 0, 0)
tcp = (socket.AF_INET6, socket.SOCK_STREAM, socket.IPPROTO_TCP, addr)
udp = (socket.AF_INET6, socket.SOCK_DGRAM, socket.IPPROTO_UDP, addr)
assert tcp in [ai[:3] + (ai[4],) for ai in res]
Expand Down