Fix output of response_for_exception in tests

Django has a django.core.handlers.exception.response_for_exception that
handles SuspiciousOperationException, that is expected behaviour and
should not be logged in test output.
This commit is contained in:
Jan Dittberner 2023-05-02 17:57:13 +02:00
parent be328758e6
commit 376cfab88f
2 changed files with 7 additions and 5 deletions

View file

@ -451,6 +451,11 @@ elif GVA_ENVIRONMENT == "test":
]
)
)
LOGGING["loggers"]["django"] = {
"handlers": ["console"],
"level": "CRITICAL",
"propagate": True,
}
BROKER_URL = BROKER_URL + "_test"
CELERY_RESULT_PERSISTENT = False
else:

View file

@ -2,10 +2,10 @@
This module provides tests for :py:mod:`userdbs.views`.
"""
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from hostingpackages.models import (
@ -14,11 +14,9 @@ from hostingpackages.models import (
HostingPackageTemplate,
UserDatabaseOption,
)
from userdbs.models import DB_TYPES, UserDatabase
from userdbs.views import AddUserDatabase, ChangeDatabaseUserPassword
User = get_user_model()
TEST_USER = "test"
@ -27,7 +25,6 @@ TEST_EMAIL = "test@example.org"
class HostingPackageAwareTestMixin(object):
# noinspection PyMethodMayBeStatic
def _setup_hosting_package(self, customer):
template = HostingPackageTemplate.objects.create(