diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-10-13 10:23:06 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-10-13 10:23:06 +0100 |
commit | 225002076de1643a00a4a2763c08704ceb03e993 (patch) | |
tree | 7383e9cc46a581d1385564765fdb4625c0c7665a /test-sftpfs | |
parent | 91fbf31274715a62a1fe6d2f8278c29bda403ab7 (diff) | |
download | obnam-225002076de1643a00a4a2763c08704ceb03e993.tar.gz |
Fix /~/ path prefix in SFTP URLs
Reported-by: Lars Kruse
Diffstat (limited to 'test-sftpfs')
-rwxr-xr-x | test-sftpfs | 18 |
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) |