diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-18 18:00:59 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-09-18 18:00:59 -0700 |
commit | 848a7209e29d580594d35f299b01db97714caf92 (patch) | |
tree | 57425aa20493dccc62bc95e59268fde66eeb368f /tests/test_transport.py | |
parent | 6ee3f1a074d2b13cca2a5d267f16159f294b98c6 (diff) | |
parent | 16a8df33eb4e9723fea244959db2b157be825781 (diff) |
Merge branch 'master' into switch-to-cryptography
Conflicts:
paramiko/ecdsakey.py
tests/test_client.py
Diffstat (limited to 'tests/test_transport.py')
-rw-r--r-- | tests/test_transport.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_transport.py b/tests/test_transport.py index 344d64b8..50b1d86b 100644 --- a/tests/test_transport.py +++ b/tests/test_transport.py @@ -20,6 +20,8 @@ Some unit tests for the ssh2 protocol in Transport. """ +from __future__ import with_statement + from binascii import hexlify import select import socket @@ -281,6 +283,22 @@ class TransportTest(unittest.TestCase): self.assertEqual('Hello there.\n', f.readline()) self.assertEqual('This is on stderr.\n', f.readline()) self.assertEqual('', f.readline()) + + def test_6a_channel_can_be_used_as_context_manager(self): + """ + verify that exec_command() does something reasonable. + """ + self.setup_test_server() + + with self.tc.open_session() as chan: + with self.ts.accept(1.0) as schan: + chan.exec_command('yes') + schan.send('Hello there.\n') + schan.close() + + f = chan.makefile() + self.assertEqual('Hello there.\n', f.readline()) + self.assertEqual('', f.readline()) def test_7_invoke_shell(self): """ |