def test_reverse_mount(self): remote = Remote("remote", self.remote, self.local1_ms, key=self.key) remote.mount() remote.reverse_mount() self._populate(self.local1_base) self._populate(remote.encfs_destination) files_remote = os.listdir(self.remote) files_reverse = os.listdir(remote.encfs_reverse) self.assertEqual(3, len(files_reverse)) for name in files_remote: if name == ".encfs6.xml": continue self.assertTrue(name in files_remote) path_remote = os.path.join(self.remote, name) path_reverse = os.path.join(remote.encfs_reverse, name) if os.path.isfile(path_remote): self.assertEqual(Repo._file_hash(path_remote), Repo._file_hash(path_reverse)) remote.reverse_umount() remote.umount()
def test_diff_content_sshfs_encfs(self): remote = Remote("remote", self.remote_host, self.local1_ms, key=self.key) remote.mount() remote.reverse_mount() self._populate(self.local1_base) self._populate(remote.encfs_destination) self._fix_mtime(self.local1_base) self._fix_mtime(remote.encfs_destination) diff = Diff(Repo(self.local1_base), Repo(remote), content=True) self.assertEqual((), self._filter(diff)) f_local = os.path.join(self.local1_base, "dir", "file_ä") f_remote = os.path.join(remote.encfs_destination, "dir", "file_ä") with io.open(f_local, "w") as f: f.write("xontent2") os.utime(f_local, (os.path.getatime(f_remote), os.path.getmtime(f_remote))) diff = Diff(Repo(self.local1_base), Repo(remote), content=True) self.assertEqual((("dir/file_ä", "content"),), self._filter(diff)) remote.reverse_umount() remote.umount()