]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Minor tweak to password test to ensure the right lines were hit
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Fri, 27 Jan 2023 19:11:09 +0000 (11:11 -0800)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Fri, 27 Jan 2023 20:24:47 +0000 (12:24 -0800)
src/documents/tests/test_barcodes.py

index 1ff69885800cfd445205ae5610a22b673ff9fb51..4f7f1278ac5031b26e58a63224912e0eb52d8ff3 100644 (file)
@@ -845,9 +845,14 @@ class TestBarcode(DirectoriesMixin, TestCase):
             - Scanning handles the exception without crashing
         """
         test_file = os.path.join(self.SAMPLE_DIR, "password-is-test.pdf")
-        doc_barcode_info = barcodes.scan_file_for_barcodes(
-            test_file,
-        )
+        with self.assertLogs("paperless.barcodes", level="WARNING") as cm:
+            doc_barcode_info = barcodes.scan_file_for_barcodes(
+                test_file,
+            )
+            warning = cm.output[0]
+            expected_str = "WARNING:paperless.barcodes:File is likely password protected, not checking for barcodes"
+            self.assertTrue(warning.startswith(expected_str))
+
         separator_page_numbers = barcodes.get_separating_barcodes(
             doc_barcode_info.barcodes,
         )