mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Replaced django.test.utils.patch_logger() with assertLogs().
Thanks Tim Graham for the review.
This commit is contained in:
@@ -14,7 +14,7 @@ from django.db import DatabaseError, connection
|
||||
from django.shortcuts import render
|
||||
from django.template import TemplateDoesNotExist
|
||||
from django.test import RequestFactory, SimpleTestCase, override_settings
|
||||
from django.test.utils import LoggingCaptureMixin, patch_logger
|
||||
from django.test.utils import LoggingCaptureMixin
|
||||
from django.urls import reverse
|
||||
from django.utils.functional import SimpleLazyObject
|
||||
from django.utils.safestring import mark_safe
|
||||
@@ -253,9 +253,8 @@ class NonDjangoTemplatesDebugViewTests(SimpleTestCase):
|
||||
|
||||
def test_400(self):
|
||||
# When DEBUG=True, technical_500_template() is called.
|
||||
with patch_logger('django.security.SuspiciousOperation', 'error'):
|
||||
response = self.client.get('/raises400/')
|
||||
self.assertContains(response, '<div class="context" id="', status_code=400)
|
||||
response = self.client.get('/raises400/')
|
||||
self.assertContains(response, '<div class="context" id="', status_code=400)
|
||||
|
||||
def test_403(self):
|
||||
response = self.client.get('/raises403/')
|
||||
|
||||
Reference in New Issue
Block a user