#NEWLINE# def _test_check_repository_error( self , http_status , payload , expected_error , **kwargs ) : #NEWLINE# #INDENT# def _http_get( service , url , * args , **kwargs ) : #NEWLINE# #INDENT# if ( http_status == 200 ) : #NEWLINE# #INDENT# return ( payload , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise HTTPError ( url , http_status , '' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , StringIO ( payload ) ) #NEWLINE# #UNINDENT# #UNINDENT# account = self . _get_hosting_account ( ) #NEWLINE# service = account . service #NEWLINE# self . spy_on ( service . client . http_get , call_fake = _http_get ) #NEWLINE# account . data [ 'authorization' ] = { #NEWLINE# #INDENT# 'token' : '123' , #NEWLINE# #UNINDENT# } #NEWLINE# try : #NEWLINE# #INDENT# service . check_repository ( ** kwargs ) #NEWLINE# saw_exception = False #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# self . assertEqual ( six . text_type ( account ) , expected_error ) #NEWLINE# saw_exception = True #NEWLINE# #UNINDENT# self . assertTrue ( saw_exception )