From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Fri, 27 Jan 2023 19:11:09 +0000 (-0800) Subject: Minor tweak to password test to ensure the right lines were hit X-Git-Tag: v1.12.2~1^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9784ea4a602df9f8cb1d627b2d370d472f3a6a48;p=thirdparty%2Fpaperless-ngx.git Minor tweak to password test to ensure the right lines were hit --- diff --git a/src/documents/tests/test_barcodes.py b/src/documents/tests/test_barcodes.py index 1ff6988580..4f7f1278ac 100644 --- a/src/documents/tests/test_barcodes.py +++ b/src/documents/tests/test_barcodes.py @@ -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, )