예제 #1
0
파일: __init__.py 프로젝트: eric011/camlipy
    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
파일: test_dir.py 프로젝트: eric011/camlipy
    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)