summaryrefslogtreecommitdiff
path: root/test/test_conn.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_conn.py')
-rw-r--r--test/test_conn.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/test_conn.py b/test/test_conn.py
index 684ffe5..f0ef8fb 100644
--- a/test/test_conn.py
+++ b/test/test_conn.py
@@ -51,21 +51,37 @@ class ConnTest(unittest.TestCase):
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
+ ]))
+
+ def test_collect_hosts__ipv6(self):
+ hosts = "[localhost]:1234,[2001:1000:2000::1],[2001:1000:2000::1]:1234"
+ results = collect_hosts(hosts)
+
+ self.assertEqual(set(results), set([
+ ('localhost', 1234, socket.AF_INET6),
+ ('2001:1000:2000::1', 9092, socket.AF_INET6),
+ ('2001:1000:2000::1', 1234, socket.AF_INET6),
]))
def test_collect_hosts__string_list(self):
hosts = [
'localhost:1234',
'localhost',
+ '[localhost]',
+ '2001::1',
+ '[2001::1]:1234',
]
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET6),
+ ('2001::1', 9092, socket.AF_INET6),
+ ('2001::1', 1234, socket.AF_INET6),
]))
def test_collect_hosts__with_spaces(self):
@@ -73,10 +89,11 @@ class ConnTest(unittest.TestCase):
results = collect_hosts(hosts)
self.assertEqual(set(results), set([
- ('localhost', 1234),
- ('localhost', 9092),
+ ('localhost', 1234, socket.AF_INET),
+ ('localhost', 9092, socket.AF_INET),
]))
+
def test_send(self):
self.conn.send(self.config['request_id'], self.config['payload'])
self.conn._sock.sendall.assert_called_with(self.config['payload'])