#NEWLINE# def testGetOobResult( self ) : #NEWLINE# #INDENT# code = '1234' #NEWLINE# with mock . patch ( 'identitytoolkit.rpchelper.RpcHelper._InvokeGitkitApi' ) as rpc_mock : #NEWLINE# #INDENT# rpc_mock . return_value = { #NEWLINE# #INDENT# 'oobCode' : code , #NEWLINE# #UNINDENT# } #NEWLINE# widget_request = { #NEWLINE# #INDENT# 'action' : 'resetPassword' , #NEWLINE# 'email' : self . email , #NEWLINE# 'response' : '8888' , #NEWLINE# #UNINDENT# } #NEWLINE# result = self . gitkitclient . GetOobResult ( widget_request , '1.1.1.1' ) #NEWLINE# self . assertEqual ( 'resetPassword' , result [ 'action' ] ) #NEWLINE# self . assertEqual ( widget_request . email , result [ 'email' ] ) #NEWLINE# self . assertEqual ( code , result [ 'oob_code' ] ) #NEWLINE# self . assertEqual ( '{"success": true}' , result [ 'response_body' ] ) #NEWLINE# self . assertTrue ( result [ 'oob_link' ] . startswith ( self . widget_url ) ) #NEWLINE# url = parse . urlparse ( result [ 'oob_link' ] ) #NEWLINE# query = parse . parse_qs ( url . query ) #NEWLINE# self . assertEqual ( 'resetPassword' , query [ 'mode' ] [ 0 ] ) #NEWLINE# self . assertEqual ( code , query [ 'oobCode' ] [ 0 ] )