From d5f46eedab08e379736d1efb416a04401dfa8d65 Mon Sep 17 00:00:00 2001 From: Brandon Rothweiler Date: Fri, 24 Feb 2023 11:27:40 -0500 Subject: [PATCH] Add tests for checks.py --- src/paperless/tests/test_checks.py | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/paperless/tests/test_checks.py b/src/paperless/tests/test_checks.py index b2d8b5810..3740d2f8a 100644 --- a/src/paperless/tests/test_checks.py +++ b/src/paperless/tests/test_checks.py @@ -105,6 +105,42 @@ class TestSettingsChecks(DirectoriesMixin, TestCase): self.assertIn('OCR output mode "makeitso"', msg.msg) + @override_settings(OCR_MODE="skip_noarchive") + def test_deprecated_ocr_type(self): + """ + GIVEN: + - Default settings + - OCR type is deprecated + WHEN: + - Settings are validated + THEN: + - deprecation warning reported for OCR type + """ + msgs = settings_values_check(None) + self.assertEqual(len(msgs), 1) + + msg = msgs[0] + + self.assertIn("deprecated", msg.msg) + + @override_settings(OCR_SKIP_ARCHIVE_FILE="invalid") + def test_invalid_ocr_skip_archive_file(self): + """ + GIVEN: + - Default settings + - OCR_SKIP_ARCHIVE_FILE is invalid + WHEN: + - Settings are validated + THEN: + - system check error reported for OCR_SKIP_ARCHIVE_FILE + """ + msgs = settings_values_check(None) + self.assertEqual(len(msgs), 1) + + msg = msgs[0] + + self.assertIn('OCR_SKIP_ARCHIVE_FILE setting "invalid"', msg.msg) + @override_settings(OCR_CLEAN="cleanme") def test_invalid_ocr_clean(self): """