#NEWLINE# def testProcessResponseReturnsResponseAsIsUnlessItsARedirect( self ) : #NEWLINE# #INDENT# self . api . _require_authentication = Mock ( return_value = 'req_auth' ) #NEWLINE# self . request . is_api = False #NEWLINE# response = HttpResponse ( ) #NEWLINE# result = self . api . process_response ( self . request , response ) #NEWLINE# self . assertTrue ( ( result is response ) , 'process_response should return the same response object' ) #NEWLINE# self . request . is_api = True #NEWLINE# result = self . api . process_response ( self . request , response ) #NEWLINE# self . assertTrue ( ( result is response ) , 'process_response should return the same response object' ) #NEWLINE# response = HttpResponseRedirect ( '/invalid/url' ) #NEWLINE# result = self . api . process_response ( self . request , response ) #NEWLINE# self . assertTrue ( ( result is response ) , 'process_response should return the same response object' ) #NEWLINE# response = HttpResponseRedirect ( settings . LOGIN_URL ) #NEWLINE# result = self . api . process_response ( self . request , response ) #NEWLINE# self . assertEqual ( result , 'req_auth' )