File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -19,19 +19,30 @@ def main():
1919    print ("paths for 200 response codes. It is intended to be run post-deploy." )
2020
2121    # Check the root url. 
22-     assert   requests . get ( args . url ). status_code   ==   200   
23- 
22+     results   =  [] 
23+      results . append ( check_for_OK ( args . url )) 
2424    # Check the /v1 paths 
25-     assert   requests . get ( args .url + '/v1/' ). status_code   ==   200 
25+     results . append ( check_for_OK ( args .url + '/v1/' )) 
2626    v1_endpoints  =  requests .get (args .url + '/v1/?format=json' ).json ()
2727    for  value  in  v1_endpoints .values ():
28-         assert   requests . get ( value ). status_code   ==   200 
28+         results . append ( check_for_OK ( value )) 
2929
3030    # Checking the /v2 paths 
31-     assert   requests . get ( args .url + '/v2/' ). status_code   ==   200 
31+     results . append ( check_for_OK ( args .url + '/v2/' )) 
3232    v2_endpoints  =  requests .get (args .url + '/v2/?format=json' ).json ()
3333    for  value  in  v2_endpoints .values ():
34-         assert  requests .get (value ).status_code  ==  200 
34+         results .append (check_for_OK (value ))
35+ 
36+     for  result  in  results :
37+         assert (result ,"Path was not OK." )
38+ 
39+ def  check_for_OK (url ):
40+     r  =  requests .get (url )
41+     if  r .status_code  !=  200 :
42+         print ("Got status {} on {}" .format (r .status_code ,url ))
43+         return  False 
44+     return  True 
45+ 
3546
3647if  __name__  ==  '__main__' :
3748    main ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments