diff --git a/mayan/apps/checkouts/tests/test_models.py b/mayan/apps/checkouts/tests/test_models.py index a7c091e303..7b280b7eb8 100644 --- a/mayan/apps/checkouts/tests/test_models.py +++ b/mayan/apps/checkouts/tests/test_models.py @@ -36,11 +36,13 @@ class DocumentCheckoutTestCase(DocumentTestMixin, BaseTestCase): ) def test_version_creation_blocking(self): - # Silence unrelated logging - logging.getLogger('documents.models').setLevel(logging.CRITICAL) - expiration_datetime = now() + datetime.timedelta(days=1) + # Silence unrelated logging + logging.getLogger('mayan.apps.documents.models').setLevel( + level=logging.CRITICAL + ) + DocumentCheckout.objects.checkout_document( document=self.document, expiration_datetime=expiration_datetime, user=self.admin_user, block_new_version=True @@ -102,7 +104,9 @@ class DocumentCheckoutTestCase(DocumentTestMixin, BaseTestCase): def test_blocking_new_versions(self): # Silence unrelated logging - logging.getLogger('documents.models').setLevel(logging.CRITICAL) + logging.getLogger('mayan.apps.documents.models').setLevel( + level=logging.CRITICAL + ) NewVersionBlock.objects.block(document=self.document) diff --git a/mayan/apps/checkouts/tests/test_views.py b/mayan/apps/checkouts/tests/test_views.py index d5d269c690..8a15dee7da 100644 --- a/mayan/apps/checkouts/tests/test_views.py +++ b/mayan/apps/checkouts/tests/test_views.py @@ -151,11 +151,13 @@ class DocumentCheckoutViewTestCase(GenericDocumentViewTestCase): # Forcefully checking in a document by a user without adequate # permissions throws out an error - # Silence unrelated logging - logging.getLogger('navigation.classes').setLevel(logging.CRITICAL) - expiration_datetime = now() + datetime.timedelta(days=1) + # Silence unrelated logging + logging.getLogger('mayan.apps.navigation.classes').setLevel( + level=logging.CRITICAL + ) + DocumentCheckout.objects.checkout_document( document=self.document, expiration_datetime=expiration_datetime, user=self.admin_user, block_new_version=True diff --git a/mayan/apps/document_signatures/tests/test_models.py b/mayan/apps/document_signatures/tests/test_models.py index b1f91de4b0..536491d3fb 100644 --- a/mayan/apps/document_signatures/tests/test_models.py +++ b/mayan/apps/document_signatures/tests/test_models.py @@ -290,7 +290,9 @@ class EmbeddedSignaturesTestCase(BaseTestCase): def test_task_verify_missing_embedded_signature(self): # Silence converter logging - logging.getLogger('converter.backends').setLevel(logging.CRITICAL) + logging.getLogger('mayan.apps.converter.backends').setLevel( + level=logging.CRITICAL + ) old_hooks = DocumentVersion._post_save_hooks diff --git a/mayan/apps/document_signatures/tests/test_views.py b/mayan/apps/document_signatures/tests/test_views.py index 448dc7d718..630f12f906 100644 --- a/mayan/apps/document_signatures/tests/test_views.py +++ b/mayan/apps/document_signatures/tests/test_views.py @@ -312,7 +312,9 @@ class SignaturesViewTestCase(GenericDocumentViewTestCase): def test_missing_signature_verify_view_no_permission(self): # Silence converter logging - logging.getLogger('converter.backends').setLevel(logging.CRITICAL) + logging.getLogger('mayan.apps.converter.backends').setLevel( + level=logging.CRITICAL + ) for document in self.document_type.documents.all(): document.delete(to_trash=False) @@ -350,7 +352,9 @@ class SignaturesViewTestCase(GenericDocumentViewTestCase): def test_missing_signature_verify_view_with_permission(self): # Silence converter logging - logging.getLogger('converter.backends').setLevel(logging.CRITICAL) + logging.getLogger('mayan.apps.converter.backends').setLevel( + level=logging.CRITICAL + ) for document in self.document_type.documents.all(): document.delete(to_trash=False) diff --git a/mayan/apps/documents/tests/test_models.py b/mayan/apps/documents/tests/test_models.py index 26f14d3193..9e3fe0fcf1 100644 --- a/mayan/apps/documents/tests/test_models.py +++ b/mayan/apps/documents/tests/test_models.py @@ -6,6 +6,7 @@ import time from django.test import override_settings from mayan.apps.common.tests import BaseTestCase +from mayan.apps.common.tests.utils import mute_stdout from ..literals import STUB_EXPIRATION_INTERVAL from ..models import ( @@ -27,7 +28,8 @@ from .mixins import DocumentTestMixin class DocumentTestCase(DocumentTestMixin, BaseTestCase): def test_natural_keys(self): self.document.pages.first().generate_image() - self._test_database_conversion('documents') + with mute_stdout(): + self._test_database_conversion('documents') def test_document_creation(self): self.assertEqual(self.document_type.label, TEST_DOCUMENT_TYPE_LABEL) diff --git a/mayan/apps/metadata/tests/test_views.py b/mayan/apps/metadata/tests/test_views.py index f45a89f898..320f04efa4 100644 --- a/mayan/apps/metadata/tests/test_views.py +++ b/mayan/apps/metadata/tests/test_views.py @@ -154,9 +154,6 @@ class DocumentMetadataTestCase(GenericDocumentViewTestCase): self.assertEqual(len(self.document.metadata.all()), 1) def test_metadata_remove_view_with_permission(self): - # Silence unrelated logging - logging.getLogger('navigation.classes').setLevel(logging.CRITICAL) - self.login_user() document_metadata = self.document.metadata.create( @@ -168,6 +165,11 @@ class DocumentMetadataTestCase(GenericDocumentViewTestCase): self.grant_permission(permission=permission_document_view) self.grant_permission(permission=permission_metadata_document_remove) + # Silence unrelated logging + logging.getLogger('mayan.apps.navigation.classes').setLevel( + level=logging.CRITICAL + ) + # Test display of metadata removal form response = self.get( 'metadata:metadata_remove', args=(self.document.pk,), diff --git a/mayan/apps/sources/tests/test_models.py b/mayan/apps/sources/tests/test_models.py index affec447a6..a055db1f2a 100644 --- a/mayan/apps/sources/tests/test_models.py +++ b/mayan/apps/sources/tests/test_models.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import logging import shutil import mock @@ -122,6 +123,10 @@ class EmailFilenameDecodingTestCase(BaseTestCase): def test_decode_email_with_attachment_and_inline_image(self): self._create_email_source() + + logging.getLogger('mayan.apps.converter').setLevel( + level=logging.CRITICAL + ) EmailBaseModel.process_message( source=self.source, message_text=TEST_EMAIL_ATTACHMENT_AND_INLINE ) @@ -167,6 +172,9 @@ class EmailFilenameDecodingTestCase(BaseTestCase): self.source.store_body = False self.source.save() + logging.getLogger('mayan.apps.converter').setLevel( + level=logging.CRITICAL + ) EmailBaseModel.process_message( source=self.source, message_text=TEST_EMAIL_ATTACHMENT_AND_INLINE ) @@ -177,6 +185,9 @@ class EmailFilenameDecodingTestCase(BaseTestCase): def test_document_upload_with_body(self): self._create_email_source() + logging.getLogger('mayan.apps.converter').setLevel( + level=logging.CRITICAL + ) EmailBaseModel.process_message( source=self.source, message_text=TEST_EMAIL_ATTACHMENT_AND_INLINE ) diff --git a/mayan/apps/sources/tests/test_views.py b/mayan/apps/sources/tests/test_views.py index bf141226a1..9f466bcf52 100644 --- a/mayan/apps/sources/tests/test_views.py +++ b/mayan/apps/sources/tests/test_views.py @@ -1,5 +1,6 @@ from __future__ import unicode_literals +import logging import os import shutil @@ -40,6 +41,8 @@ class DocumentUploadTestCase(GenericDocumentViewTestCase): self.document.delete() def _request_upload_wizard_view(self): + logging.getLogger('django.request').setLevel(level=logging.CRITICAL) + with open(TEST_SMALL_DOCUMENT_PATH, mode='rb') as file_object: return self.post( viewname='sources:upload_interactive', args=(self.source.pk,), @@ -95,6 +98,8 @@ class DocumentUploadTestCase(GenericDocumentViewTestCase): self.assertEqual(Document.objects.count(), 1) def _request_upload_interactive_view(self): + logging.getLogger('django.request').setLevel(level=logging.CRITICAL) + return self.get( viewname='sources:upload_interactive', data={ 'document_type_id': self.document_type.pk,