summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorScott Kuhl <kuhl@mtu.edu>2020-10-26 17:24:32 -0400
committerScott Kuhl <kuhl@mtu.edu>2020-10-26 17:24:32 -0400
commit34f538ff9899c4267e735d4ecd528610d76c1631 (patch)
tree97525350ba24cf6e1f9628ede100172057f1665a /tests
parent68c9c9bbcd75e43c7e0326f8da796df9876b0334 (diff)
parent5c8c7072080d1f29323767caf2495ecebf1ea8e4 (diff)
Merge branch 'master' into which-fix to resolve merge conflict.
Diffstat (limited to 'tests')
-rw-r--r--tests/client/test_methods_nat.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/client/test_methods_nat.py b/tests/client/test_methods_nat.py
index 11a901b..a9d2a25 100644
--- a/tests/client/test_methods_nat.py
+++ b/tests/client/test_methods_nat.py
@@ -18,12 +18,22 @@ def test_get_supported_features():
def test_get_tcp_dstip():
sock = Mock()
+ sock.family = AF_INET
sock.getsockopt.return_value = struct.pack(
'!HHBBBB', socket.ntohs(AF_INET), 1024, 127, 0, 0, 1)
method = get_method('nat')
assert method.get_tcp_dstip(sock) == ('127.0.0.1', 1024)
assert sock.mock_calls == [call.getsockopt(0, 80, 16)]
+ sock = Mock()
+ sock.family = AF_INET6
+ sock.getsockopt.return_value = struct.pack(
+ '!HH4xBBBBBBBBBBBBBBBB', socket.ntohs(AF_INET6),
+ 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1)
+ method = get_method('nft')
+ assert method.get_tcp_dstip(sock) == ('::1', 1024)
+ assert sock.mock_calls == [call.getsockopt(41, 80, 64)]
+
def test_recv_udp():
sock = Mock()