* fix(images): background jobs skip files hidden by the removal mark; walkers skip trash folders inside output roots (#501) - Thumbnail jobs and the legacy scan_output_dir listing leave library-removed files out (one mark check, mark_hides). - Missing-file links also forgets removal marks that hide nothing any more (file gone from a folder that exists, or changed), only under a readable, non-empty source, re-checked at apply. - The sidebar Images, Favorites and Needs review counts and the collection counts are read again when an image_delete job ends. - utils/media_folders.py: one skip for thumbnails and trash folders (.Trash, .Trash-<uid>, .Trashes, $RECYCLE.BIN) used by every walker, the image monitor and the delete review. * test(browser): wait for the answers two specs raced in the merge queue (#501) - System diagnostics "level filter": wait for each level's own log answer, and poll the shown levels; the CRITICAL line is in the previous level's answer too, so it proved nothing (firefox). - Library editor "restored storage after a confirmed save": wait for the PATCH answer, which waits for a whole restore in the test's route, instead of the 5 s expect default (webkit).
42 lines
1.4 KiB
Python
42 lines
1.4 KiB
Python
"""The shared folder skip every media walker uses (#501)."""
|
|
|
|
import unittest
|
|
|
|
from utils.media_folders import in_skipped_folder, is_skipped_folder, is_trash_folder
|
|
|
|
|
|
class TrashFolderNameTests(unittest.TestCase):
|
|
def test_trash_folder_names_in_any_case(self):
|
|
for name in (
|
|
".Trash",
|
|
".trash",
|
|
".Trash-1000",
|
|
".trash-0",
|
|
".Trashes",
|
|
"$RECYCLE.BIN",
|
|
"$Recycle.Bin",
|
|
):
|
|
with self.subTest(name=name):
|
|
self.assertTrue(is_trash_folder(name))
|
|
self.assertTrue(is_skipped_folder(name))
|
|
|
|
def test_other_names_are_not_trash(self):
|
|
for name in (".Trash-abc", ".Trash-", "trash", "Recycle", "RECYCLE.BIN", "x"):
|
|
with self.subTest(name=name):
|
|
self.assertFalse(is_trash_folder(name))
|
|
|
|
def test_thumbnails_is_skipped_exactly(self):
|
|
self.assertTrue(is_skipped_folder("thumbnails"))
|
|
self.assertFalse(is_skipped_folder("Thumbnails"))
|
|
self.assertFalse(is_trash_folder("thumbnails"))
|
|
|
|
def test_folder_parts(self):
|
|
self.assertTrue(in_skipped_folder(("a", ".Trash-1000", "files")))
|
|
self.assertTrue(in_skipped_folder(("thumbnails",)))
|
|
self.assertFalse(in_skipped_folder(("a", "b")))
|
|
self.assertFalse(in_skipped_folder(()))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|