2013-07-01 20:22:27 +08:00
|
|
|
import unittest
|
|
|
|
|
2009-12-10 00:57:23 +08:00
|
|
|
from django import http
|
|
|
|
from django.contrib.messages.middleware import MessageMiddleware
|
|
|
|
|
|
|
|
|
2017-01-05 22:23:39 +08:00
|
|
|
class MiddlewareTests(unittest.TestCase):
|
2009-12-10 00:57:23 +08:00
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.middleware = MessageMiddleware()
|
|
|
|
|
|
|
|
def test_response_without_messages(self):
|
|
|
|
"""
|
2017-01-05 22:23:39 +08:00
|
|
|
MessageMiddleware is tolerant of messages not existing on request.
|
2009-12-10 00:57:23 +08:00
|
|
|
"""
|
|
|
|
request = http.HttpRequest()
|
|
|
|
response = http.HttpResponse()
|
|
|
|
self.middleware.process_response(request, response)
|