Пример #1
0
    def put_directory(self, path, permanode=False):
        """ Shortcut for upload an entire directory.

        Call camlipy.directory.put_directory under the hood.

        """
        return put_directory(self, path, permanode=permanode)
Пример #2
0
    def put_directory(self, path, permanode=False):
        """ Shortcut for upload an entire directory.

        Call camlipy.directory.put_directory under the hood.

        """
        return put_directory(self, path, permanode=permanode)
Пример #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)
Пример #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)