mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-14 00:09:35 -06:00
Breaking: Remove pybzar as a barcode reader (#12065)
This commit is contained in:
@@ -167,17 +167,6 @@ def settings_values_check(app_configs, **kwargs):
|
||||
)
|
||||
return msgs
|
||||
|
||||
def _barcode_scanner_validate():
|
||||
"""
|
||||
Validates the barcode scanner type
|
||||
"""
|
||||
msgs = []
|
||||
if settings.CONSUMER_BARCODE_SCANNER not in ["PYZBAR", "ZXING"]:
|
||||
msgs.append(
|
||||
Error(f'Invalid Barcode Scanner "{settings.CONSUMER_BARCODE_SCANNER}"'),
|
||||
)
|
||||
return msgs
|
||||
|
||||
def _email_certificate_validate():
|
||||
msgs = []
|
||||
# Existence checks
|
||||
@@ -195,7 +184,6 @@ def settings_values_check(app_configs, **kwargs):
|
||||
return (
|
||||
_ocrmypdf_settings_check()
|
||||
+ _timezone_validate()
|
||||
+ _barcode_scanner_validate()
|
||||
+ _email_certificate_validate()
|
||||
)
|
||||
|
||||
|
||||
@@ -1106,11 +1106,6 @@ CONSUMER_BARCODE_STRING: Final[str] = os.getenv(
|
||||
"PATCHT",
|
||||
)
|
||||
|
||||
CONSUMER_BARCODE_SCANNER: Final[str] = os.getenv(
|
||||
"PAPERLESS_CONSUMER_BARCODE_SCANNER",
|
||||
"PYZBAR",
|
||||
).upper()
|
||||
|
||||
CONSUMER_ENABLE_ASN_BARCODE: Final[bool] = __get_boolean(
|
||||
"PAPERLESS_CONSUMER_ENABLE_ASN_BARCODE",
|
||||
)
|
||||
|
||||
@@ -187,31 +187,6 @@ class TestTimezoneSettingsChecks(DirectoriesMixin, TestCase):
|
||||
self.assertIn('Timezone "TheMoon\\MyCrater"', msg.msg)
|
||||
|
||||
|
||||
class TestBarcodeSettingsChecks(DirectoriesMixin, TestCase):
|
||||
@override_settings(CONSUMER_BARCODE_SCANNER="Invalid")
|
||||
def test_barcode_scanner_invalid(self) -> None:
|
||||
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) -> None:
|
||||
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) -> None:
|
||||
msgs = settings_values_check(None)
|
||||
self.assertEqual(len(msgs), 0)
|
||||
|
||||
|
||||
class TestEmailCertSettingsChecks(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
|
||||
@override_settings(EMAIL_CERTIFICATE_FILE=Path("/tmp/not_actually_here.pem"))
|
||||
def test_not_valid_file(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user