mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	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)
 |