diff options
author | Enrico Canzonieri <ecanzonieri@gmail.com> | 2015-10-24 16:50:46 -0700 |
---|---|---|
committer | Enrico Canzonieri <enrico@yelp.com> | 2015-11-10 17:58:04 -0800 |
commit | c2adeeab057b825c8cccae67aac822be02293211 (patch) | |
tree | ee745273c341f5bb482ebe98fda89496bee97b7c /test | |
parent | 04920bb89f9d73e4028dbd487719975c65954592 (diff) | |
download | kafka-python-c2adeeab057b825c8cccae67aac822be02293211.tar.gz |
Add tests. Bug fix. Rename socket_conn dict.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_conn.py | 17 |
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 |