more tests

This commit is contained in:
jonaswinkler 2020-12-22 13:04:08 +01:00
parent f42e5bf1e5
commit b7d310ef90
2 changed files with 15 additions and 2 deletions

View File

@ -51,6 +51,6 @@ def parser_check(app_configs, **kwargs):
if len(parsers) == 0:
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:
return []

View File

@ -1,9 +1,12 @@
import unittest
from unittest import mock
from django.core.checks import Error
from django.test import TestCase
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
@ -15,3 +18,13 @@ class ChecksTestCase(TestCase):
def test_changed_password_check_no_encryption(self):
DocumentFactory.create(storage_type=Document.STORAGE_TYPE_UNENCRYPTED)
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.")])