summaryrefslogtreecommitdiff
path: root/tests/messages_tests/test_middleware.py
blob: 6b5733fdd2cc81afec91f52932799aae4fcce194 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
        )