File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -570,6 +570,30 @@ def test_should_restore_global_headers(self):
570570        self .assertTrue ('x-test'  in  headers )
571571        self .assertEqual (headers ['x-test' ], 'Global' )
572572
573+     def  test_should_allow_to_nest_additional_header_blocks (self ):
574+         # given 
575+         client  =  Server ('http://localhost:%d'  %  self .port , verbose = 1 )
576+ 
577+         # when 
578+         with  client ._additional_headers ({'X-Level-1'  : '1' }) as  cl_level1 :
579+             with  self .captured_headers () as  headers1 :
580+                 response  =  cl_level1 .ping ()
581+                 self .assertTrue (response )
582+ 
583+             with  cl_level1 ._additional_headers ({'X-Level-2'  : '2' }) as  cl :
584+                 with  self .captured_headers () as  headers2 :
585+                     response  =  cl .ping ()
586+                     self .assertTrue (response )
587+ 
588+         # then 
589+         self .assertTrue ('x-level-1'  in  headers1 )
590+         self .assertEqual (headers1 ['x-level-1' ], '1' )
591+ 
592+         self .assertTrue ('x-level-1'  in  headers2 )
593+         self .assertEqual (headers1 ['x-level-1' ], '1' )
594+         self .assertTrue ('x-level-2'  in  headers2 )
595+         self .assertEqual (headers2 ['x-level-2' ], '2' )
596+ 
573597""" Test Methods """ 
574598def  subtract (minuend , subtrahend ):
575599    """ Using the keywords from the JSON-RPC v2 doc """ 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments