File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,15 @@ def update_last_request_time(current_app):
3333        current_app .config .update (LAST_REQUEST_TIME = LAST_REQUEST_TIME )
3434
3535
36+ def  before_request (current_app ):
37+     increment_request_counter (current_app )
38+ 
39+ 
40+ def  teardown_request (current_app ):
41+     decrement_request_counter (current_app )
42+     update_last_request_time (current_app )
43+ 
44+ 
3645def  kill_task (current_app ):
3746    DESKTOP_APP  =  bool (current_app .config .get ("DESKTOP_APP" ))
3847    REQUEST_COUNTER  =  int (current_app .config .get ("REQUEST_COUNTER" ))
Original file line number Diff line number Diff line change @@ -20,6 +20,20 @@ def test_update_last_request_time(app_context):
2020    assert  flask .current_app .config .get ("LAST_REQUEST_TIME" ) >=  LAST_REQUEST_TIME 
2121
2222
23+ def  test_before_request (app_context ):
24+     assert  flask .current_app .config .get ("REQUEST_COUNTER" ) ==  0 
25+     utils_functions .before_request (flask .current_app )
26+     assert  flask .current_app .config .get ("REQUEST_COUNTER" ) ==  1 
27+ 
28+ 
29+ def  test_teardown_request (app_context ):
30+     LAST_REQUEST_TIME  =  flask .current_app .config .get ("LAST_REQUEST_TIME" )
31+     assert  flask .current_app .config .get ("REQUEST_COUNTER" ) ==  1 
32+     utils_functions .teardown_request (flask .current_app )
33+     assert  flask .current_app .config .get ("REQUEST_COUNTER" ) ==  0 
34+     assert  flask .current_app .config .get ("LAST_REQUEST_TIME" ) >=  LAST_REQUEST_TIME 
35+ 
36+ 
2337def  test_versions ():
2438    list_packages  =  [
2539        "OpenGeode-core" ,
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments