From 89d6e422f5929eabb1e1b263a06b7f164eda2038 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Sat, 2 Jan 2021 15:37:27 +0100 Subject: [PATCH] fix bugs and test cases --- src/documents/file_handling.py | 4 +++- src/paperless_tesseract/tests/test_parser.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documents/file_handling.py b/src/documents/file_handling.py index 5643756ac..a5274a5f4 100644 --- a/src/documents/file_handling.py +++ b/src/documents/file_handling.py @@ -100,7 +100,9 @@ def generate_filename(doc, counter=0): many_to_dictionary(doc.tags)) tag_list = pathvalidate.sanitize_filename( - ",".join([tag.name for tag in doc.tags.all()]), + ",".join(sorted( + [tag.name for tag in doc.tags.all()] + )), replacement_text="-" ) diff --git a/src/paperless_tesseract/tests/test_parser.py b/src/paperless_tesseract/tests/test_parser.py index 7be176663..644587de0 100644 --- a/src/paperless_tesseract/tests/test_parser.py +++ b/src/paperless_tesseract/tests/test_parser.py @@ -78,7 +78,7 @@ class TestParser(DirectoriesMixin, TestCase): parser.get_thumbnail(os.path.join(self.SAMPLE_FILES, 'simple-digital.pdf'), "application/pdf") # dont really know how to test it, just call it and assert that it does not raise anything. - @mock.patch("paperless_tesseract.parsers.run_convert") + @mock.patch("documents.parsers.run_convert") def test_thumbnail_fallback(self, m): def call_convert(input_file, output_file, **kwargs):