-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dd2c94
commit 5c83167
Showing
2 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from api.helpers import _zip_them_all | ||
from unittest import TestCase | ||
import zipfile | ||
from pathlib import Path | ||
|
||
class ZipTest(TestCase): | ||
""" | ||
Test Zips | ||
""" | ||
|
||
def setUp(self): | ||
self.file = open("files/file.txt", "a") | ||
self.file.write("some data") | ||
self.file.close() | ||
|
||
def test_zip_duplicate_name(self): | ||
zip_file1 = zipfile.ZipFile('files/zip1.zip', 'w', zipfile.ZIP_DEFLATED) | ||
zip_file1.write(self.file.name, Path(self.file.name).name) | ||
zip_file1.close() | ||
zip_file2 = zipfile.ZipFile('files/zip2.zip', 'w', zipfile.ZIP_DEFLATED) | ||
zip_file2.write(self.file.name, Path(self.file.name).name) | ||
zip_file2.close() | ||
|
||
_zip_them_all('files/full_zip.zip', ['zip1.zip', 'zip2.zip', 'file.txt']) |