コード例 #1
0
ファイル: test_posix.py プロジェクト: anujkumar93/stor
    def test_posix_destination_already_exists(self):
        with stor.NamedTemporaryDirectory() as tmp_d:
            source = tmp_d / '1'
            source.makedirs_p()

            with self.assertRaisesRegexp(OSError, 'exists'):
                utils.copytree(source, tmp_d)
コード例 #2
0
ファイル: test_posix.py プロジェクト: anujkumar93/stor
    def test_posix_destination_w_error(self):
        with stor.NamedTemporaryDirectory() as tmp_d:
            invalid_source = tmp_d / 'source'
            dest = tmp_d / 'my' / 'dest'

            with self.assertRaises(OSError):
                utils.copytree(invalid_source, dest)
コード例 #3
0
ファイル: test_posix.py プロジェクト: anujkumar93/stor
    def test_posix_destination_w_cmd(self):
        with stor.NamedTemporaryDirectory() as tmp_d:
            source = tmp_d / 'source'
            os.mkdir(source)
            with open(source / '1', 'w') as tmp_file:
                tmp_file.write('1')

            dest = tmp_d / 'my' / 'dest'
            utils.copytree(source, dest, copy_cmd='cp -r')
            self.assertTrue((dest / '1').exists())
コード例 #4
0
ファイル: test_posix.py プロジェクト: anujkumar93/stor
    def test_swift_destination(self, mock_upload):
        source = '.'
        dest = Path('swift://tenant/container')
        options = {
            'swift:upload': {
                'object_threads': 30,
                'segment_threads': 40
            }
        }

        with settings.use(options):
            utils.copytree(source, dest)
        mock_upload.assert_called_once_with(dest, ['.'],
                                            condition=None,
                                            use_manifest=False,
                                            headers=None)