We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
_manage_ftp
FTPFS.upload
1 parent 72e2fc9 commit 923dad9Copy full SHA for 923dad9
tests/test_ftpfs.py
@@ -12,7 +12,12 @@
12
import unittest
13
import uuid
14
15
-from six import text_type
+try:
16
+ from unittest import mock
17
+except ImportError:
18
+ import mock
19
+
20
+from six import text_type, BytesIO
21
22
from ftplib import error_perm
23
from ftplib import error_temp
@@ -275,6 +280,12 @@ def test_create(self):
275
280
with open_fs(url, create=True) as ftp_fs:
276
281
self.assertTrue(ftp_fs.isfile("foo"))
277
282
283
+ def test_upload_connection(self):
284
+ with mock.patch.object(self.fs, "_manage_ftp") as _manage_ftp:
285
+ self.fs.upload("foo", BytesIO(b"hello"))
286
+ self.assertEqual(self.fs.gettext("foo"), "hello")
287
+ _manage_ftp.assert_not_called()
288
278
289
279
290
class TestFTPFSNoMLSD(TestFTPFS):
291
def make_fs(self):
0 commit comments