aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_postprocessor.py
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2022-09-22 19:43:58 -0400
committerLibravatarUnit 193 <unit193@unit193.net>2022-09-22 19:43:58 -0400
commit3330e3e88a192c9b6374674dade39350c0e72330 (patch)
tree0f039b5561c9d2a637b90830acb3935e207581c0 /test/test_postprocessor.py
parent8d8fa380c97c0d07934a74140d48b273faa11992 (diff)
parente6b82556343116256be047ab7099bedd9063f66a (diff)
Update upstream source from tag 'upstream/1.23.1'
Update to upstream version '1.23.1' with Debian dir 9d2a90ca4525fa589ae5b82b2a9dd158c57d11ba
Diffstat (limited to 'test/test_postprocessor.py')
-rw-r--r--test/test_postprocessor.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/test_postprocessor.py b/test/test_postprocessor.py
index 42babd3..af8b0af 100644
--- a/test/test_postprocessor.py
+++ b/test/test_postprocessor.py
@@ -452,9 +452,11 @@ class ZipTest(BasePostprocessorTest):
self.assertTrue(pp.args[0].endswith("/test.cbz"))
def test_zip_write(self):
- pp = self._create()
-
with tempfile.NamedTemporaryFile("w", dir=self.dir.name) as file:
+ pp = self._create({"files": [file.name, "_info_.json"],
+ "keep-files": True})
+
+ filename = os.path.basename(file.name)
file.write("foobar\n")
# write dummy file with 3 different names
@@ -466,18 +468,19 @@ class ZipTest(BasePostprocessorTest):
self._trigger()
nti = pp.zfile.NameToInfo
- self.assertEqual(len(nti), i+1)
+ self.assertEqual(len(nti), i+2)
self.assertIn(name, nti)
# check file contents
- self.assertEqual(len(nti), 3)
+ self.assertEqual(len(nti), 4)
self.assertIn("file0.ext", nti)
self.assertIn("file1.ext", nti)
self.assertIn("file2.ext", nti)
+ self.assertIn(filename, nti)
# write the last file a second time (will be skipped)
self._trigger()
- self.assertEqual(len(pp.zfile.NameToInfo), 3)
+ self.assertEqual(len(pp.zfile.NameToInfo), 4)
# close file
self._trigger(("finalize",), 0)
@@ -485,10 +488,11 @@ class ZipTest(BasePostprocessorTest):
# reopen to check persistence
with zipfile.ZipFile(pp.zfile.filename) as file:
nti = file.NameToInfo
- self.assertEqual(len(pp.zfile.NameToInfo), 3)
+ self.assertEqual(len(pp.zfile.NameToInfo), 4)
self.assertIn("file0.ext", nti)
self.assertIn("file1.ext", nti)
self.assertIn("file2.ext", nti)
+ self.assertIn(filename, nti)
os.unlink(pp.zfile.filename)