summaryrefslogtreecommitdiffhomepage
path: root/tests/test_transport.py
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2007-11-20 00:25:27 -0500
committerRobey Pointer <robey@lag.net>2007-11-20 00:25:27 -0500
commit92e92a9297770661eb578bfab2735136e3d98a5b (patch)
treebeb872b14060e7df4b33aeae2f2202185d29cad1 /tests/test_transport.py
parent2fcbacee7fc4fe4780c5188d6e247506cab197de (diff)
[project @ robey@lag.net-20071120052527-hloi0b30yngbay0x]
add send_ready() and a unit test.
Diffstat (limited to 'tests/test_transport.py')
-rw-r--r--tests/test_transport.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_transport.py b/tests/test_transport.py
index 6aaf7386..bae960e5 100644
--- a/tests/test_transport.py
+++ b/tests/test_transport.py
@@ -677,3 +677,26 @@ class TransportTest (unittest.TestCase):
schan.close()
chan.close()
+
+ def test_L_send_ready(self):
+ """
+ verify that send_ready() indicates when a send would not block.
+ """
+ self.setup_test_server()
+ chan = self.tc.open_session()
+ chan.invoke_shell()
+ schan = self.ts.accept(1.0)
+
+ self.assertEquals(chan.send_ready(), True)
+ total = 0
+ K = '*' * 1024
+ while total < 1024 * 1024:
+ chan.send(K)
+ total += len(K)
+ if not chan.send_ready():
+ break
+ self.assert_(total < 1024 * 1024)
+
+ schan.close()
+ chan.close()
+ self.assertEquals(chan.send_read(), True)