#NEWLINE# def test_really_bad_decode( self ) : #NEWLINE# #INDENT# self . old_method = remoting . decode #NEWLINE# remoting . decode = ( lambda * args , **kwargs : self . _raiseException ( Exception , * args , ** kwargs ) ) #NEWLINE# http_request = http . HttpRequest ( ) #NEWLINE# http_request . method = 'POST' #NEWLINE# http_request . raw_post_data = '' #NEWLINE# gw = django . DjangoGateway ( ) #NEWLINE# try : #NEWLINE# #INDENT# http_response = gw ( http_request ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# remoting . decode = self . old_method #NEWLINE# raise #NEWLINE# #UNINDENT# remoting . decode = self . old_method #NEWLINE# self . assertTrue ( isinstance ( http_response , http . HttpResponseServerError ) ) #NEWLINE# self . assertEqual ( http_response . status_code , 500 ) #NEWLINE# self . assertEqual ( http_response . content , '500 Internal Server Error\n\nAn unexpected error occurred.' )