mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
add first tests for barcode reader
Signed-off-by: florian on nixos (Florian Brandes) <florian.brandes@posteo.de>
This commit is contained in:

committed by
Florian Brandes

parent
c35814bfd3
commit
aa46b06d95
BIN
src/documents/tests/samples/patch-code-t.pbm
Normal file
BIN
src/documents/tests/samples/patch-code-t.pbm
Normal file
Binary file not shown.
BIN
src/documents/tests/samples/patch-code-t.pdf
Normal file
BIN
src/documents/tests/samples/patch-code-t.pdf
Normal file
Binary file not shown.
@@ -13,6 +13,8 @@ from documents.sanity_checker import SanityCheckFailedException
|
||||
from documents.sanity_checker import SanityCheckMessages
|
||||
from documents.tests.utils import DirectoriesMixin
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class TestTasks(DirectoriesMixin, TestCase):
|
||||
def test_index_reindex(self):
|
||||
@@ -89,6 +91,15 @@ class TestTasks(DirectoriesMixin, TestCase):
|
||||
mtime3 = os.stat(settings.MODEL_FILE).st_mtime
|
||||
self.assertNotEqual(mtime2, mtime3)
|
||||
|
||||
def test_barcode_reader(self):
|
||||
test_file = os.path.join(
|
||||
os.path.dirname(__file__),
|
||||
"samples",
|
||||
"patch-code-t.pbm"
|
||||
)
|
||||
img = Image.open(test_file)
|
||||
self.assertEqual(tasks.barcode_reader(img), ["b'PATCHT'"])
|
||||
|
||||
@mock.patch("documents.tasks.sanity_checker.check_sanity")
|
||||
def test_sanity_check_success(self, m):
|
||||
m.return_value = SanityCheckMessages()
|
||||
|
Reference in New Issue
Block a user