summaryrefslogtreecommitdiff
path: root/test-sftpfs
diff options
context:
space:
mode:
Diffstat (limited to 'test-sftpfs')
-rwxr-xr-xtest-sftpfs18
1 files changed, 18 insertions, 0 deletions
diff --git a/test-sftpfs b/test-sftpfs
index ee725b70..52f7e369 100755
--- a/test-sftpfs
+++ b/test-sftpfs
@@ -28,6 +28,7 @@ ssh connections using the ssh agent.
import logging
import os
+import pwd
import shutil
import tempfile
import unittest
@@ -60,6 +61,23 @@ class SftpTests(unittest.TestCase, obnamlib.VfsTests):
def test_sets_path_to_absolute_path(self):
self.assert_(self.fs.path.startswith('/'))
+ def test_resolves_magic_homedir_prefix(self):
+ baseurl = 'sftp://localhost/~/'
+ settings = {
+ 'pure-paramiko': False,
+ 'create': True,
+ 'sftp-delay': 0,
+ 'ssh-key': '',
+ 'strict-ssh-host-keys': False,
+ 'ssh-known-hosts': os.path.expanduser('~/.ssh/known_hosts'),
+ }
+ fs = obnamlib.plugins.sftp_plugin.SftpFS(baseurl, settings=settings)
+ fs.connect()
+
+ homedir = pwd.getpwuid(os.getuid()).pw_dir
+ self.assertEqual(fs._initial_dir, homedir)
+ self.assertEqual(fs.getcwd(), homedir)
+
def test_initial_cwd_is_basepath(self):
self.assertEqual(self.fs.getcwd(), self.fs.path)