diff options
| author | 2022-09-22 19:43:53 -0400 | |
|---|---|---|
| committer | 2022-09-22 19:43:53 -0400 | |
| commit | e6b82556343116256be047ab7099bedd9063f66a (patch) | |
| tree | 884c0435863d130ec967163b82a2638ff1bd9505 /test/test_postprocessor.py | |
| parent | a768930761f7f20587ae40a8cacca0e55c85290a (diff) | |
New upstream version 1.23.1.upstream/1.23.1
Diffstat (limited to 'test/test_postprocessor.py')
| -rw-r--r-- | test/test_postprocessor.py | 16 |
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) |
