Exemplo n.º 1
0
    def test__sync_2(self):
        union = OverlayFileSystem(original=self.first(), overlay=self.second())

        # sync the union; first is synced, and second is not.
        union.sync()
        self.failUnless(
            os.path.exists(os.sep.join(
                self.first().rootdirectory().abspath())))
        self.failUnless(
            os.path.exists(os.sep.join(self.first_first_file().abspath())))
        self.failUnless(
            os.path.exists(os.sep.join(self.first_subdir().abspath())))
        self.failUnless(
            os.path.exists(
                os.sep.join(self.first_subdir_first_file().abspath())))
        self.failIf(
            os.path.exists(os.sep.join(
                self.second().rootdirectory().abspath())))
        self.failIf(
            os.path.exists(os.sep.join(self.second_second_file().abspath())))
        self.failIf(os.path.exists(os.sep.join(
            self.second_subdir().abspath())))
        self.failIf(
            os.path.exists(
                os.sep.join(self.second_subdir_second_file().abspath())))

        # add file and dir here and there, sync and check again.
        union.rootdirectory().add(name='newfile', entry=File())
        newdir = union.rootdirectory().add(name='newdir', entry=Directory())
        newdir.add(name='newfile', entry=File())

        union.sync()

        self.failUnless(
            os.path.exists(
                os.sep.join(self.first().rootdirectory().abspath() +
                            ['newfile'])))
        self.failUnless(
            os.path.exists(
                os.sep.join(self.first().rootdirectory().abspath() +
                            ['newdir'])))
        self.failUnless(
            os.path.exists(
                os.sep.join(self.first().rootdirectory().abspath() +
                            ['newdir', 'newfile'])))
        self.failIf(
            os.path.exists(
                os.sep.join(self.second().rootdirectory().abspath() +
                            ['newfile'])))
        self.failIf(
            os.path.exists(
                os.sep.join(self.second().rootdirectory().abspath() +
                            ['newdir'])))
        self.failIf(
            os.path.exists(
                os.sep.join(self.second().rootdirectory().abspath() +
                            ['newdir', 'newfile'])))
        pass
Exemplo n.º 2
0
    def test__sync_1(self):

        # all write access goes to first, and so does sync

        union = OverlayFileSystem(original=self.first(), overlay=self.second())
        union.sync()

        self.failUnless(
            os.path.exists(os.sep.join(self.first_first_file().abspath())))
        self.failUnless(
            os.path.exists(os.sep.join(self.first_subdir().abspath())))
        self.failUnless(
            os.path.exists(
                os.sep.join(self.first_subdir_first_file().abspath())))

        self.failIf(
            os.path.exists(os.sep.join(self.second_second_file().abspath())))
        self.failIf(os.path.exists(os.sep.join(
            self.second_subdir().abspath())))
        self.failIf(
            os.path.exists(
                os.sep.join(self.second_subdir_second_file().abspath())))

        pass