From a3fe422198b1faf75afaf8e2ccfc752dcba64c82 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 4 Mar 2013 08:45:00 -0500 Subject: [PATCH] Adding test capturing desired behavior and demonstrating issue #142. --- tests/test_sftp.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_sftp.py b/tests/test_sftp.py index dfd673a..b1697ea 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -31,6 +31,7 @@ import warnings import sys import threading import unittest +import StringIO import paramiko from stub_sftp import StubServer, StubSFTPServer @@ -724,3 +725,16 @@ class SFTPTest (unittest.TestCase): f.close() finally: sftp.remove(FOLDER + '/append.txt') + + def test_putfo_empty_file(self): + """ + Send an empty file and confirm it is sent. + """ + target = FOLDER + '/empty file.txt' + stream = StringIO.StringIO() + try: + attrs = sftp.putfo(stream, target) + # the returned attributes should not be null + self.assertNotEqual(attrs, None) + finally: + sftp.remove(target)