summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2005-07-13 08:35:15 +0000
committerRobey Pointer <robey@lag.net>2005-07-13 08:35:15 +0000
commit93f3cae64ffa5698175b6f89a677b64a66a29a59 (patch)
tree65847abd7ddc713743488274c99d82ec19d6461c /tests
parent1f88224239546d1ef9dcfce77572765d9a094623 (diff)
[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-33]
add SFTPClient.put and SFTPClient.get, and make sftp file objects auto-close on del
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_sftp.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index f4b5fea2..992c9dc3 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -540,3 +540,32 @@ class SFTPTest (unittest.TestCase):
except:
pass
+ def test_J_get_put(self):
+ """
+ verify that get/put work.
+ """
+ import os, warnings
+ warnings.filterwarnings('ignore', 'tempnam.*')
+
+ localname = os.tempnam()
+ text = 'All I wanted was a plastic bunny rabbit.\n'
+ f = open(localname, 'w')
+ f.write(text)
+ f.close()
+ sftp.put(localname, FOLDER + '/bunny.txt')
+
+ f = sftp.open(FOLDER + '/bunny.txt', 'r')
+ self.assertEquals(text, f.read(128))
+ f.close()
+
+ os.unlink(localname)
+ localname = os.tempnam()
+ sftp.get(FOLDER + '/bunny.txt', localname)
+
+ f = open(localname, 'r')
+ self.assertEquals(text, f.read(128))
+ f.close()
+
+ os.unlink(localname)
+ sftp.unlink(FOLDER + '/bunny.txt')
+