#NEWLINE# def test_success( self ) : #NEWLINE# #INDENT# token_time = 123456789 #NEWLINE# curr_time = ( ( token_time + xsrfutil . DEFAULT_TIMEOUT_SECS ) - 1 ) #NEWLINE# key = object ( ) #NEWLINE# user_id = object ( ) #NEWLINE# action_id = object ( ) #NEWLINE# token = base64 . b64encode ( _to_bytes ( str ( token_time ) ) ) #NEWLINE# with mock . patch ( 'oauth2client.contrib.xsrfutil.generate_token' , return_value = token ) as gen_tok : #NEWLINE# #INDENT# self . assertTrue ( xsrfutil . validate_token ( key , token , user_id , current_time = curr_time , action_id = action_id ) ) #NEWLINE# gen_tok . assert_called_once_with ( key , user_id , action_id = action_id , when = token_time )