Avoid overwriting custom image names

This commit is contained in:
2026-10-15 14:57:27 +00:00
parent 64a8e8a439
commit 873028f783
3 changed files with 38 additions and 3 deletions
+13
View File
@@ -122,6 +122,19 @@ class DumasImageNodeTests(unittest.TestCase):
["batch_003.png", "batch_004.png"],
)
def test_save_without_counter_token_does_not_overwrite(self):
with tempfile.TemporaryDirectory() as directory:
FakeImage.saved_paths.clear()
open(os.path.join(directory, "cover.png"), "wb").close()
self.nodes.DumasSaveImageNode().save_images(
[FakeBatch()], directory, "cover", "png", 95, False, True
)
self.assertEqual(
os.path.basename(FakeImage.saved_paths[-1][0]),
"cover_001.png",
)
if __name__ == "__main__":
unittest.main()