@@ -40,7 +40,7 @@ def get_client_ip_address(request):
4040
4141
4242def get_template_context (request ):
43- return {"TEST_MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT " : True }
43+ return {"TEST_MAINTENANCE_MODE_GET_CONTEXT " : True }
4444
4545
4646@override_settings (
@@ -961,44 +961,38 @@ def test_middleware_get_template_context(self):
961961
962962 settings .MAINTENANCE_MODE = True
963963
964- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = (
965- "tests.tests.get_template_context"
966- )
964+ settings .MAINTENANCE_MODE_GET_CONTEXT = "tests.tests.get_template_context"
967965 response = self .client .get ("/" )
968- val = response .context .get ("TEST_MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT " , False )
966+ val = response .context .get ("TEST_MAINTENANCE_MODE_GET_CONTEXT " , False )
969967 self .assertTrue (val )
970968
971969 get_template_context_error = False
972970 try :
973- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = (
971+ settings .MAINTENANCE_MODE_GET_CONTEXT = (
974972 "tests.tests_invalid.get_template_context_invalid"
975973 )
976974 response = self .client .get ("/" )
977- val = response .context .get (
978- "TEST_MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT" , False
979- )
975+ val = response .context .get ("TEST_MAINTENANCE_MODE_GET_CONTEXT" , False )
980976 self .assertFalse (val )
981977 except ImproperlyConfigured :
982978 get_template_context_error = True
983979 self .assertTrue (get_template_context_error )
984980
985981 get_template_context_error = False
986982 try :
987- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = (
983+ settings .MAINTENANCE_MODE_GET_CONTEXT = (
988984 "tests.tests.get_template_context_invalid"
989985 )
990986 response = self .client .get ("/" )
991- val = response .context .get (
992- "TEST_MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT" , False
993- )
987+ val = response .context .get ("TEST_MAINTENANCE_MODE_GET_CONTEXT" , False )
994988 self .assertFalse (val )
995989 except ImproperlyConfigured :
996990 get_template_context_error = True
997991 self .assertTrue (get_template_context_error )
998992
999- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None
993+ settings .MAINTENANCE_MODE_GET_CONTEXT = None
1000994 response = self .client .get ("/" )
1001- val = response .context .get ("TEST_MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT " , False )
995+ val = response .context .get ("TEST_MAINTENANCE_MODE_GET_CONTEXT " , False )
1002996 self .assertFalse (val )
1003997
1004998 def test_middleware_response_type (self ):
@@ -1084,7 +1078,7 @@ def tearDown(self):
10841078 # Clean up settings
10851079 settings .MAINTENANCE_MODE_REDIRECT_URL = None
10861080 settings .MAINTENANCE_MODE_TEMPLATE = "503.html"
1087- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None
1081+ settings .MAINTENANCE_MODE_GET_CONTEXT = None
10881082
10891083 def test_redirect (self ):
10901084 settings .MAINTENANCE_MODE_REDIRECT_URL = "http://redirect.example.cz/"
@@ -1096,7 +1090,7 @@ def test_redirect(self):
10961090
10971091 def test_no_context (self ):
10981092 settings .MAINTENANCE_MODE_TEMPLATE = "503.html"
1099- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = None
1093+ settings .MAINTENANCE_MODE_GET_CONTEXT = None
11001094
11011095 response = http .get_maintenance_response (RequestFactory ().get ("/dummy/" ))
11021096
@@ -1109,9 +1103,7 @@ def test_no_context(self):
11091103
11101104 def test_custom_context (self ):
11111105 settings .MAINTENANCE_MODE_TEMPLATE = "503.html"
1112- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = (
1113- "tests.tests.get_template_context"
1114- )
1106+ settings .MAINTENANCE_MODE_GET_CONTEXT = "tests.tests.get_template_context"
11151107
11161108 response = http .get_maintenance_response (RequestFactory ().get ("/dummy/" ))
11171109
@@ -1123,9 +1115,7 @@ def test_custom_context(self):
11231115 self .assertIn ("max-age=0" , response ["Cache-Control" ])
11241116
11251117 def test_invalid_context_function (self ):
1126- settings .MAINTENANCE_MODE_GET_TEMPLATE_CONTEXT = (
1127- "invalid.invalid-context-function"
1128- )
1118+ settings .MAINTENANCE_MODE_GET_CONTEXT = "invalid.invalid-context-function"
11291119
11301120 self .assertRaisesMessage (
11311121 ImproperlyConfigured ,
0 commit comments