From 743ee886be2baded6d1657df7d09707055cef8aa Mon Sep 17 00:00:00 2001 From: Marvin Gaube Date: Mon, 20 Mar 2023 20:31:50 +0100 Subject: [PATCH] feat: add tests for barcode scanner value checks --- src/paperless/tests/test_checks.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/paperless/tests/test_checks.py b/src/paperless/tests/test_checks.py index 3740d2f8a..7c233de23 100644 --- a/src/paperless/tests/test_checks.py +++ b/src/paperless/tests/test_checks.py @@ -176,3 +176,26 @@ class TestSettingsChecks(DirectoriesMixin, TestCase): msg = msgs[0] self.assertIn('Timezone "TheMoon\\MyCrater"', msg.msg) + + @override_settings(CONSUMER_BARCODE_SCANNER="Invalid") + def test_barcode_scanner_invalid(self): + msgs = settings_values_check(None) + self.assertEqual(len(msgs), 1) + + msg = msgs[0] + + self.assertIn('Invalid Barcode Scanner "Invalid"', msg.msg) + + @override_settings(CONSUMER_BARCODE_SCANNER="") + def test_barcode_scanner_empty(self): + msgs = settings_values_check(None) + self.assertEqual(len(msgs), 1) + + msg = msgs[0] + + self.assertIn('Invalid Barcode Scanner ""', msg.msg) + + @override_settings(CONSUMER_BARCODE_SCANNER="PYZBAR") + def test_barcode_scanner_valid(self): + msgs = settings_values_check(None) + self.assertEqual(len(msgs), 0)