mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Added more tests for @cache_control decorator.
This commit is contained in:
		
				
					committed by
					
						 Mariusz Felisiak
						Mariusz Felisiak
					
				
			
			
				
	
			
			
			
						parent
						
							c24cd6575f
						
					
				
				
					commit
					a14ddc8cfc
				
			| @@ -42,6 +42,25 @@ class CacheControlDecoratorTest(SimpleTestCase): | ||||
|         response = MyClass().a_view(HttpRequestProxy(request)) | ||||
|         self.assertEqual(response.headers["Cache-Control"], "a=b") | ||||
|  | ||||
|     def test_cache_control_empty_decorator(self): | ||||
|         @cache_control() | ||||
|         def a_view(request): | ||||
|             return HttpResponse() | ||||
|  | ||||
|         response = a_view(HttpRequest()) | ||||
|         self.assertEqual(response.get("Cache-Control"), "") | ||||
|  | ||||
|     def test_cache_control_full_decorator(self): | ||||
|         @cache_control(max_age=123, private=True, public=True, custom=456) | ||||
|         def a_view(request): | ||||
|             return HttpResponse() | ||||
|  | ||||
|         response = a_view(HttpRequest()) | ||||
|         cache_control_items = response.get("Cache-Control").split(", ") | ||||
|         self.assertEqual( | ||||
|             set(cache_control_items), {"max-age=123", "private", "public", "custom=456"} | ||||
|         ) | ||||
|  | ||||
|  | ||||
| class CachePageDecoratorTest(SimpleTestCase): | ||||
|     def test_cache_page(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user