summaryrefslogtreecommitdiff
path: root/test/test_conn.py
diff options
context:
space:
mode:
authorDana Powers <dana.powers@gmail.com>2015-12-02 14:21:13 -0800
committerDana Powers <dana.powers@gmail.com>2015-12-02 14:21:13 -0800
commit58e2ab41a76518c433d7375a24191018b85ced85 (patch)
tree4d1fdb80c101bdc2ed0b333ea75d81ddb4fba67c /test/test_conn.py
parentcdcaea6f944df10941522ebcb08946bf34c357db (diff)
parentc2adeeab057b825c8cccae67aac822be02293211 (diff)
downloadkafka-python-58e2ab41a76518c433d7375a24191018b85ced85.tar.gz
Merge pull request #473 from ecanzonieri/use_unblocking_io_for_aware_requests
Use unblocking io for broker aware requests
Diffstat (limited to 'test/test_conn.py')
-rw-r--r--test/test_conn.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_conn.py b/test/test_conn.py
index 2b70344..1bdfc1e 100644
--- a/test/test_conn.py
+++ b/test/test_conn.py
@@ -165,6 +165,23 @@ class ConnTest(unittest.TestCase):
self.assertEqual(self.conn.recv(self.config['request_id']), self.config['payload'])
self.assertEqual(self.conn.recv(self.config['request_id']), self.config['payload2'])
+ def test_get_connected_socket(self):
+ s = self.conn.get_connected_socket()
+
+ self.assertEqual(s, self.MockCreateConn())
+
+ def test_get_connected_socket_on_dirty_conn(self):
+ # Dirty the connection
+ try:
+ self.conn._raise_connection_error()
+ except ConnectionError:
+ pass
+
+ # Test that get_connected_socket tries to connect
+ self.assertEqual(self.MockCreateConn.call_count, 0)
+ self.conn.get_connected_socket()
+ self.assertEqual(self.MockCreateConn.call_count, 1)
+
def test_close__object_is_reusable(self):
# test that sending to a closed connection