Example #1
0
    def get_directory(self, br, path):
        """ Shortcut for restoring/retrieving a directory.

        Call camlipy.directory.get_directory under the hood.

        """
        return get_directory(self, br, path)
Example #2
0
    def get_directory(self, br, path):
        """ Shortcut for restoring/retrieving a directory.

        Call camlipy.directory.get_directory under the hood.

        """
        return get_directory(self, br, path)
Example #3
0
    def testDirectory(self):
        tmpdir = tempfile.mkdtemp()
        with open(os.path.join(tmpdir, 'testfile1'), 'wb') as fh:
            fh.write(os.urandom(256 << 10))
        testdir = os.path.join(tmpdir, 'testdir')
        os.mkdir(testdir)
        with open(os.path.join(testdir, 'testfile2'), 'wb') as fh:
            fh.write(os.urandom(256 << 10))

        dir_br = put_directory(self.server, tmpdir)

        dest = tempfile.mkdtemp()

        get_directory(self.server, dir_br, dest)

        # Check the two directories are equal using Dirtools.hash
        self.assertEqual(Dir(tmpdir).hash(), Dir(dest).hash())

        shutil.rmtree(tmpdir)
        shutil.rmtree(dest)
Example #4
0
    def testDirectory(self):
        tmpdir = tempfile.mkdtemp()
        with open(os.path.join(tmpdir, 'testfile1'), 'wb') as fh:
            fh.write(os.urandom(256 << 10))
        testdir = os.path.join(tmpdir, 'testdir')
        os.mkdir(testdir)
        with open(os.path.join(testdir, 'testfile2'), 'wb') as fh:
            fh.write(os.urandom(256 << 10))

        dir_br = put_directory(self.server, tmpdir)

        dest = tempfile.mkdtemp()

        get_directory(self.server, dir_br, dest)

        # Check the two directories are equal using Dirtools.hash
        self.assertEqual(Dir(tmpdir).hash(),
                         Dir(dest).hash())

        shutil.rmtree(tmpdir)
        shutil.rmtree(dest)