示例#1
0
 def test_main_mount_pull_umount(self):
     self._populate(self.remote)
     os.chdir(self.local2_base)
     sys.argv[1:] = ["pull", "remote", "-u"]
     synkrotron.main()
     remote = Remote("remote", self.remote, self.local2_ms)
     self.assertFalse(os.path.exists(remote._sync_path("sshfs")))
     self.assertEqual(3, len(os.listdir(self.local2_base)))
示例#2
0
 def test_main_umount(self):
     remote = Remote("remote", self.remote_host, self.local3_ms, key=self.key, mount_point=self.mount_point)
     remote.mount()
     os.chdir(self.local3_base)
     sys.argv[1:] = ["umount", "remote"]
     synkrotron.main()
     self.assertFalse(os.path.exists(self.mount_point))
     self.assertFalse(os.path.exists(remote._sync_path("sshfs")))
     self.assertFalse(os.path.exists(remote._sync_path("encfs")))
示例#3
0
 def test_mount_sshfs(self):
     remote = Remote("remote", self.remote_host, self.local1_ms)
     path = remote.mount()
     self.assertEqual(remote._sync_path("sshfs"), path)
     self.assertTrue(os.path.ismount(path))
     self._populate(path)
     remote.umount()
     self.assertFalse(os.path.exists(path))
     self.assertEqual(2, len(os.listdir(self.remote)))
     with self.assertRaises(Exception):
         Remote("remote", self.remote_host + "x", self.local2_ms).mount()
示例#4
0
 def test_mount_sshfs_encfs_mp(self):
     remote = Remote("remote", self.remote_host, self.local1_ms, key=self.key, mount_point=self.mount_point)
     path = remote.mount()
     self.assertEqual(self.mount_point, path)
     self.assertTrue(os.path.islink(path))
     target_sshfs = remote._sync_path("sshfs")
     target_encfs = remote._sync_path("encfs")
     self.assertTrue(os.path.ismount(target_sshfs))
     self.assertTrue(os.path.ismount(target_encfs))
     self._populate(path)
     remote.umount()
     self.assertFalse(os.path.exists(path))
     self.assertFalse(os.path.exists(target_sshfs))
     self.assertFalse(os.path.exists(target_encfs))
     self.assertEqual(3, len(os.listdir(self.remote)))
示例#5
0
 def test_mount_encfs(self):
     remote = Remote("remote", self.remote, self.local1_ms, key=self.key)
     path = remote.mount()
     self.assertEqual(remote._sync_path("encfs"), path)
     self.assertEqual(self.remote, remote.encfs_source)
     self.assertTrue(os.path.ismount(path))
     self._populate(path)
     remote.umount()
     self.assertFalse(os.path.exists(path))
     self.assertEqual(3, len(os.listdir(self.remote)))
     # inexistent location
     with self.assertRaises(Exception):
         Remote("remote", self.remote + "x", self.local1_ms, key=self.key).mount()
     # re-mount with wrong key
     remote = Remote("remote", self.remote, self.local2_ms, key=self.key)
     remote.mount()
     remote.umount()
     remote = Remote("remote", self.remote, self.local2_ms, key=self.key + "x")
     with self.assertRaises(Exception):
         remote.mount()