2013-07-01 14:22:27 +02:00
|
|
|
import unittest
|
|
|
|
|
2009-12-09 16:57:23 +00:00
|
|
|
from django.contrib.messages.middleware import MessageMiddleware
|
2017-02-25 12:48:20 +06:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
2009-12-09 16:57:23 +00:00
|
|
|
|
|
|
|
|
2017-01-05 09:23:39 -05:00
|
|
|
class MiddlewareTests(unittest.TestCase):
|
2009-12-09 16:57:23 +00:00
|
|
|
def test_response_without_messages(self):
|
|
|
|
"""
|
2017-01-05 09:23:39 -05:00
|
|
|
MessageMiddleware is tolerant of messages not existing on request.
|
2009-12-09 16:57:23 +00:00
|
|
|
"""
|
2017-02-25 12:48:20 +06:00
|
|
|
request = HttpRequest()
|
|
|
|
response = HttpResponse()
|
2019-09-26 19:06:35 +02:00
|
|
|
MessageMiddleware(lambda req: HttpResponse()).process_response(
|
|
|
|
request, response
|
|
|
|
)
|