#NEWLINE# @ responses . activate #NEWLINE# def test_retrier_does_not_catch_unwanted_exception( self ) : #NEWLINE# #INDENT# client = HubstorageClient ( auth = self . auth , endpoint = self . endpoint , max_retries = 2 , max_retry_time = 1 ) #NEWLINE# job_metadata = { #NEWLINE# #INDENT# 'project' : self . projectid , #NEWLINE# 'spider' : self . spidername , #NEWLINE# 'state' : 'pending' , #NEWLINE# #UNINDENT# } #NEWLINE# ( callback , attempts_count ) = self . make_request_callback ( 3 , job_metadata , http_error_status = 403 ) #NEWLINE# self . mock_api ( callback = callback ) #NEWLINE# ( job , metadata , err ) = ( None , None , None ) #NEWLINE# try : #NEWLINE# #INDENT# job = client . get_job ( ( '%s/%s/%s' % ( self . projectid , self . spiderid , 42 ) ) ) #NEWLINE# metadata = dict ( job . metadata ) #NEWLINE# #UNINDENT# except HTTPError as e : #NEWLINE# #INDENT# err = e #NEWLINE# #UNINDENT# self . assertIsNone ( metadata ) #NEWLINE# self . assertIsNotNone ( err ) #NEWLINE# self . assertEqual ( err . response . status_code , 403 ) #NEWLINE# self . assertEqual ( attempts_count [ 0 ] , 1 )