|
5 | 5 |
|
6 | 6 | import json |
7 | 7 | import base64 |
| 8 | +import zipfile |
8 | 9 | import pytest |
9 | 10 | from aioresponses import aioresponses |
10 | 11 | from cryptography.hazmat.primitives import serialization, hashes |
@@ -311,8 +312,6 @@ async def test_export_zip_png_detection(): |
311 | 312 | assert result == output_path |
312 | 313 |
|
313 | 314 | # Verify ZIP contains PNG |
314 | | - import zipfile |
315 | | - |
316 | 315 | with zipfile.ZipFile(output_path, "r") as zf: |
317 | 316 | files = zf.namelist() |
318 | 317 | assert "pictures/manifest.json" in files |
@@ -351,8 +350,6 @@ async def test_export_zip_picture_decrypt_error(): |
351 | 350 | await client.export_data_zip(output_path, include_pictures=True) |
352 | 351 |
|
353 | 352 | # Should complete despite error |
354 | | - import zipfile |
355 | | - |
356 | 353 | with zipfile.ZipFile(output_path, "r") as zf: |
357 | 354 | manifest = json.loads(zf.read("pictures/manifest.json")) |
358 | 355 | # Error should be recorded |
@@ -393,8 +390,6 @@ async def test_export_zip_location_decrypt_error(): |
393 | 390 | await client.export_data_zip(output_path, include_pictures=False) |
394 | 391 |
|
395 | 392 | # Should complete with error recorded |
396 | | - import zipfile |
397 | | - |
398 | 393 | with zipfile.ZipFile(output_path, "r") as zf: |
399 | 394 | locations = json.loads(zf.read("locations.json")) |
400 | 395 | assert "error" in locations[0] |
@@ -980,7 +975,6 @@ async def test_export_zip_default_jpg_extension(): |
980 | 975 |
|
981 | 976 | try: |
982 | 977 | import tempfile |
983 | | - import zipfile |
984 | 978 |
|
985 | 979 | with tempfile.NamedTemporaryFile(suffix=".zip", delete=False) as tmp: |
986 | 980 | output_path = tmp.name |
|
0 commit comments