0
0
mirror of https://github.com/django/django.git synced 2024-11-25 16:09:27 +01:00
django/tests/messages_tests/test_middleware.py
Claude Paroz 4d973f5939 Refs #26601 -- Deprecated passing None as get_response arg to middleware classes.
This is the new contract since middleware refactoring in Django 1.10.

Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-02-18 20:03:44 +01:00

16 lines
478 B
Python

import unittest
from django.contrib.messages.middleware import MessageMiddleware
from django.http import HttpRequest, HttpResponse
class MiddlewareTests(unittest.TestCase):
def test_response_without_messages(self):
"""
MessageMiddleware is tolerant of messages not existing on request.
"""
request = HttpRequest()
response = HttpResponse()
MessageMiddleware(lambda req: HttpResponse()).process_response(request, response)