diff options
author | mangano-ito <47137677+mangano-ito@users.noreply.github.com> | 2022-02-09 21:24:03 +0900 |
---|---|---|
committer | mangano-ito <47137677+mangano-ito@users.noreply.github.com> | 2022-02-09 21:29:24 +0900 |
commit | 19e2a1810d40dc5b2dd1596d9cb805480455ed16 (patch) | |
tree | 212b6e3067b75314bf6e9992fe77a4ed700af375 | |
parent | 2f026c84af9b471c407261756b3ec7c32f203282 (diff) |
add getaddrinfo mock for test-cases with hosts
-rw-r--r-- | tests/client/test_options.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/client/test_options.py b/tests/client/test_options.py index c367213..91e2871 100644 --- a/tests/client/test_options.py +++ b/tests/client/test_options.py @@ -27,6 +27,15 @@ _ip6_reprs = { _ip6_swidths = (48, 64, 96, 115, 128) +def _mock_getaddrinfo(host, *_): + return { + "example.com": [ + (socket.AF_INET6, socket.SOCK_STREAM, 0, '', ('2606:2800:220:1:248:1893:25c8:1946', 0, 0, 0)), + (socket.AF_INET, socket.SOCK_STREAM, 0, '', ('93.184.216.34', 0)), + ], + }.get(host, []) + + def test_parse_subnetport_ip4(): for ip_repr, ip in _ip4_reprs.items(): assert sshuttle.options.parse_subnetport(ip_repr) \ |