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