コード例 #1
0
    def test_load_invalid_uuid4_root_dir(self):
        fp = pathlib.Path(self.temp_dir.name) / 'invalid-uuid4'
        zp = pathlib.Path(self.temp_dir.name) / 'bad.zip'
        fp.mkdir()
        # Invalid uuid4 taken from https://gist.github.com/ShawnMilo/7777304
        root_dir = '89eb3586-8a82-47a4-c911-758a62601cf7'

        record = _ZipArchive.setup(fp, 'foo', 'bar')
        (fp / str(record.uuid)).rename(fp / root_dir)
        _ZipArchive.save(fp, zp)

        with self.assertRaisesRegex(ValueError,
                                    'root directory.*valid version 4 UUID'):
            _ZipArchive(zp)
コード例 #2
0
ファイル: test_archiver.py プロジェクト: jairideout/qiime2
    def test_load_invalid_uuid4_root_dir(self):
        fp = pathlib.Path(self.temp_dir.name) / 'invalid-uuid4'
        zp = pathlib.Path(self.temp_dir.name) / 'bad.zip'
        fp.mkdir()
        # Invalid uuid4 taken from https://gist.github.com/ShawnMilo/7777304
        root_dir = '89eb3586-8a82-47a4-c911-758a62601cf7'

        record = _ZipArchive.setup(fp, 'foo', 'bar')
        (fp / str(record.uuid)).rename(fp / root_dir)
        _ZipArchive.save(fp, zp)

        with self.assertRaisesRegex(ValueError,
                                    'root directory.*valid version 4 UUID'):
            _ZipArchive(zp)
コード例 #3
0
ファイル: test_v0.py プロジェクト: gregcaporaso/qiime2
    def test_load_root_dir_metadata_uuid_mismatch(self):
        fp = pathlib.Path(self.temp_dir.name) / 'root-dir-metadata-mismatch'
        fp.mkdir()

        r = _ZipArchive.setup(fp, 'foo', 'bar')
        fake = ArchiveRecord(r.root, r.version_fp,
                             _uuid.uuid4(),  # This will trick the format
                             r.version, r.framework_version)

        ArchiveFormat.write(fake, IntSequence1, IntSequenceDirectoryFormat,
                            lambda x: None, None)
        with self.assertRaisesRegex(
                ValueError, 'root directory must match UUID.*metadata'):
            ArchiveFormat(r)
コード例 #4
0
    def test_load_root_dir_metadata_uuid_mismatch(self):
        fp = pathlib.Path(self.temp_dir.name) / 'root-dir-metadata-mismatch'
        fp.mkdir()

        r = _ZipArchive.setup(fp, 'foo', 'bar')
        fake = ArchiveRecord(
            r.root,
            r.version_fp,
            _uuid.uuid4(),  # This will trick the format
            r.version,
            r.framework_version)

        ArchiveFormat.write(fake, IntSequence1, IntSequenceDirectoryFormat,
                            lambda x: None, None)
        with self.assertRaisesRegex(
                ValueError, 'root directory must match UUID.*metadata'):
            ArchiveFormat(r)