def _TestGenerateAccessToken(action, tester, device_dict, auth_info_dict, user_cookie=None, use_short_token=True):
 response_dict = _GenerateAccessToken(action, tester, device_dict, auth_info_dict, user_cookie, use_short_token=use_short_token)
 (identity_type, value) = Identity.SplitKey(auth_info_dict['identity'])
 expected_digits = (4 if (use_short_token or (identity_type == 'Phone')) else 9)
 assert (response_dict['token_digits'] == expected_digits), response_dict
 identity = tester._RunAsync(Identity.Query, tester.validator.client, auth_info_dict['identity'], None)
 tester.validator.ValidateUpdateDBObject(Identity, key=auth_info_dict['identity'], authority='Viewfinder', user_id=identity.user_id, access_token=identity.access_token, expires=identity.expires)
 return identity

def _TestGenerateAccessToken ( action , tester , device_dict , auth_info_dict , user_cookie = None , use_short_token = True ) : response_dict = _GenerateAccessToken ( action , tester , device_dict , auth_info_dict , user_cookie , use_short_token = use_short_token ) ( identity_type , value ) = Identity . SplitKey ( auth_info_dict [ 'identity' ] ) expected_digits = ( 4 if ( use_short_token or ( identity_type == 'Phone' ) ) else 9 ) assert ( response_dict [ 'token_digits' ] == expected_digits ) , response_dict identity = tester . _RunAsync ( Identity . Query , tester . validator . client , auth_info_dict [ 'identity' ] , None ) tester . validator . ValidateUpdateDBObject ( Identity , key = auth_info_dict [ 'identity' ] , authority = 'Viewfinder' , user_id = identity . user_id , access_token = identity . access_token , expires = identity . expires ) return identity
invokes the auth api that triggers the email of a viewfinder access token .