mirror of
https://github.com/django/django.git
synced 2024-11-29 06:03:25 +01:00
4d973f5939
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>
16 lines
478 B
Python
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)
|