mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
Merge branch 'dev' into feature-bulk-edit
This commit is contained in:
commit
cd8f99d2c3
@ -51,6 +51,6 @@ def parser_check(app_configs, **kwargs):
|
|||||||
|
|
||||||
if len(parsers) == 0:
|
if len(parsers) == 0:
|
||||||
return [Error("No parsers found. This is a bug. The consumer won't be "
|
return [Error("No parsers found. This is a bug. The consumer won't be "
|
||||||
"able to onsume any documents without parsers.")]
|
"able to consume any documents without parsers.")]
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from django.core.management import BaseCommand
|
from django.core.management import BaseCommand
|
||||||
|
from django.db import transaction
|
||||||
|
|
||||||
from documents.mixins import Renderable
|
from documents.mixins import Renderable
|
||||||
from documents.tasks import index_reindex, index_optimize
|
from documents.tasks import index_reindex, index_optimize
|
||||||
@ -18,8 +19,8 @@ class Command(Renderable, BaseCommand):
|
|||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
|
||||||
self.verbosity = options["verbosity"]
|
self.verbosity = options["verbosity"]
|
||||||
|
with transaction.atomic():
|
||||||
if options['command'] == 'reindex':
|
if options['command'] == 'reindex':
|
||||||
index_reindex()
|
index_reindex()
|
||||||
elif options['command'] == 'optimize':
|
elif options['command'] == 'optimize':
|
||||||
index_optimize()
|
index_optimize()
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
from django.core.checks import Error
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .factories import DocumentFactory
|
from .factories import DocumentFactory
|
||||||
from ..checks import changed_password_check
|
from .. import document_consumer_declaration
|
||||||
|
from ..checks import changed_password_check, parser_check
|
||||||
from ..models import Document
|
from ..models import Document
|
||||||
|
|
||||||
|
|
||||||
@ -15,3 +18,13 @@ class ChecksTestCase(TestCase):
|
|||||||
def test_changed_password_check_no_encryption(self):
|
def test_changed_password_check_no_encryption(self):
|
||||||
DocumentFactory.create(storage_type=Document.STORAGE_TYPE_UNENCRYPTED)
|
DocumentFactory.create(storage_type=Document.STORAGE_TYPE_UNENCRYPTED)
|
||||||
self.assertEqual(changed_password_check(None), [])
|
self.assertEqual(changed_password_check(None), [])
|
||||||
|
|
||||||
|
def test_parser_check(self):
|
||||||
|
|
||||||
|
self.assertEqual(parser_check(None), [])
|
||||||
|
|
||||||
|
with mock.patch('documents.checks.document_consumer_declaration.send') as m:
|
||||||
|
m.return_value = []
|
||||||
|
|
||||||
|
self.assertEqual(parser_check(None), [Error("No parsers found. This is a bug. The consumer won't be "
|
||||||
|
"able to consume any documents without parsers.")])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user