Skip to content

Instantly share code, notes, and snippets.

@zerok
Created May 17, 2015 20:54
Show Gist options
  • Save zerok/4e2d313f440436750588 to your computer and use it in GitHub Desktop.
Save zerok/4e2d313f440436750588 to your computer and use it in GitHub Desktop.
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 6a514ac..ddb87cf 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -1,7 +1,6 @@
from copy import deepcopy
from paramiko import Transport
from paramiko.channel import Channel
-from paramiko.sftp_attr import SFTPAttributes
from paramiko.sftp_client import SFTPClient
import pytest
import sys
@@ -127,6 +126,17 @@ def test_sftpserver_mkdir(content, sftpclient):
assert set(sftpclient.listdir("/a")) == set(["b", "c", "f", "x"])
+def test_sftpserver_mkdir_existing(content, sftpclient):
+ """
+ Executing mkdir on an existing directory path should raise an IOError
+ indicating that the directory already exists without affecting the
+ content of the existing directory.
+ """
+ with pytest.raises(IOError):
+ sftpclient.mkdir('/a')
+ assert set(sftpclient.listdir("/a")) == set(["b", "c", "f"])
+
+
def test_sftpserver_chmod(content, sftpclient):
# coverage
sftpclient.chmod("/a/b", 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment