@@ -72,6 +72,7 @@ def test_wsgi_context_1():
7272 "outgoing_req_redirects" : [],
7373 "executed_middleware" : False ,
7474 "route_params" : [],
75+ "protection_forced_off" : None ,
7576 }
7677 assert context .get_user_agent () is None
7778
@@ -103,6 +104,7 @@ def test_wsgi_context_2():
103104 "outgoing_req_redirects" : [],
104105 "executed_middleware" : False ,
105106 "route_params" : [],
107+ "protection_forced_off" : None ,
106108 }
107109 assert context .get_user_agent () == "Mozilla/5.0"
108110
@@ -284,3 +286,13 @@ def test_set_valid_json_with_special_characters_bytes():
284286 context = Context (req = basic_wsgi_req , body = None , source = "flask" )
285287 context .set_body (b'{"key": "value with special characters !@#$%^&*()"}' )
286288 assert context .body == {"key" : "value with special characters !@#$%^&*()" }
289+
290+
291+ def test_set_protection_forced_off ():
292+ context = Context (req = basic_wsgi_req , body = None , source = "flask" )
293+ context .set_force_protection_off (True )
294+ assert context .protection_forced_off is True
295+ context .set_force_protection_off (False )
296+ assert context .protection_forced_off is False
297+ context .set_force_protection_off (None )
298+ assert context .protection_forced_off is None
0 commit comments