|
1 | 1 | # Security protection test cases |
2 | 2 | import ctypes |
3 | 3 | import os |
4 | | -import pathlib |
5 | 4 | import sys |
6 | | -from dataclasses import dataclass |
7 | | -from tempfile import TemporaryDirectory |
8 | 5 |
|
9 | 6 | import pytest |
10 | 7 |
|
@@ -79,28 +76,3 @@ def test_extract_symlink_attack(tmp_path): |
79 | 76 | with pytest.raises(Bad7zFile): |
80 | 77 | with SevenZipFile(target, "r") as archive: |
81 | 78 | archive.extractall(path=target_dir) |
82 | | - |
83 | | - |
84 | | -def test_write_compressed_archive(tmp_path): |
85 | | - @dataclass |
86 | | - class Contents: |
87 | | - filename: str |
88 | | - text: str |
89 | | - |
90 | | - contents = (Contents(filename="bin/qmake", text="qqqqq"), Contents(filename="lib/libhoge.so", text="hoge")) |
91 | | - with TemporaryDirectory() as temp_path, SevenZipFile( |
92 | | - tmp_path / "tools_qtcreator-linux-qt.tools.qtcreator.7z", "w" |
93 | | - ) as archive: |
94 | | - dest = pathlib.Path(temp_path) |
95 | | - for folder in ("bin", "lib", "mkspecs"): |
96 | | - (dest / folder).mkdir(parents=True, exist_ok=True) |
97 | | - for f in contents: |
98 | | - full_path = dest / f.filename |
99 | | - if not full_path.parent.exists(): |
100 | | - full_path.parent.mkdir(parents=True) |
101 | | - full_path.write_text(f.text, "utf_8") |
102 | | - archive.writeall(path=temp_path, arcname="target") |
103 | | - with TemporaryDirectory() as target_path, SevenZipFile( |
104 | | - tmp_path / "tools_qtcreator-linux-qt.tools.qtcreator.7z", "r" |
105 | | - ) as archive: |
106 | | - archive.extractall(path=target_path) |
0 commit comments