Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_mkdir(self, sftp_conn, sftp_client, tmpdir):
"""Tests the `mkdir` method with mode parameter."""
dir_path = posixpath.join(str(tmpdir), "subdir")
assert not sftp_client.exists(dir_path)
with SftpHook("sftp_default") as hook:
hook.mkdir(dir_path, mode=0o750)
assert sftp_client.exists(dir_path)
assert pysftp.st_mode_to_int(sftp_client.stat(dir_path).st_mode) == 750
def test_makedirs(self, sftp_conn, sftp_client, tmpdir):
"""Tests the `mkdir` method with mode parameter."""
dir_path = posixpath.join(str(tmpdir), "some", "nested", "dir")
with SftpHook("sftp_default") as hook:
hook.makedirs(dir_path, mode=0o750)
assert sftp_client.exists(dir_path)
assert pysftp.st_mode_to_int(sftp_client.stat(dir_path).st_mode) == 750