#NEWLINE# def test_TranslateApitoolsResumableUploadException( self ) : #NEWLINE# #INDENT# 'Tests that _TranslateApitoolsResumableUploadException works correctly.' #NEWLINE# gsutil_api = GcsJsonApi ( GSMockBucketStorageUri , CreateGsutilLogger ( 'copy_test' ) , DiscardMessagesQueue ( ) ) #NEWLINE# gsutil_api . http . disable_ssl_certificate_validation = True #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 503 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ServiceException ) ) #NEWLINE# gsutil_api . http . disable_ssl_certificate_validation = False #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 503 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadException ) ) #NEWLINE# gsutil_api . http . disable_ssl_certificate_validation = False #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 429 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadException ) ) #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 410 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadStartOverException ) ) #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 404 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadStartOverException ) ) #NEWLINE# exc = apitools_exceptions . HttpError ( { #NEWLINE# #INDENT# 'status' : 401 , #NEWLINE# #UNINDENT# } , None , None ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadAbortException ) ) #NEWLINE# exc = apitools_exceptions . TransferError ( 'Aborting transfer' ) #NEWLINE# translated_exc = gsutil_api . _TranslateApitoolsResumableUploadException ( exc ) #NEWLINE# self . assertTrue ( isinstance ( translated_exc , ResumableUploadAbortException ) )