File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1
1
# -*- coding: utf-8 -*-
2
2
from __future__ import unicode_literals
3
3
4
+ try :
5
+ from mock import patch
6
+ except ImportError :
7
+ from unittest .mock import patch # noqa
8
+
9
+ from django .core .exceptions import MiddlewareNotUsed
4
10
from django .test import TestCase
5
11
from django .http import HttpRequest , HttpResponse
6
12
@@ -34,3 +40,9 @@ def test_middleware_text(self):
34
40
response = MinifyHTMLMiddleware ().process_response (self .req , self .resp )
35
41
self .assertIn ('text/plain' , response ['Content-Type' ])
36
42
self .assertIn (self .whitespace , response .content )
43
+
44
+ @patch ('pipeline.middleware.settings.PIPELINE_ENABLED' , False )
45
+ def test_middleware_not_used (self ):
46
+ self .resp ['Content-Type' ] = 'text/plain; charset=UTF-8'
47
+
48
+ self .assertRaises (MiddlewareNotUsed , MinifyHTMLMiddleware )
You can’t perform that action at this time.
0 commit comments