Beispiel #1
0
def third_login_test(third_way,clear=False,*args):
    api = UserRequest(mode)
    custom = {}
    if int(third_way) == 4:
        custom = {
            'platform':args[0],
            'uid':args[1],
            'screen_name':args[2],
            'profile_image_url':args[3]
        }
    third_way_dict = {
        '1':WEIBO_LOGIN_INFO,
        '2':QQ_LOGIN_INFO,
        '3':WECHAT_LOGIN_INFO,
        '4':custom
    }
    third_info = third_way_dict[third_way]
    platform = third_info['platform']
    uid = third_info['uid']
    screen_name = third_info['screen_name']
    profile_image_url = third_info['profile_image_url']
    userinfo = api.openid_login(platform,uid,screen_name,profile_image_url)
    if clear:
        clear_result = user_clear(userinfo)
        assert clear_result
    return userinfo
Beispiel #2
0
def third_login_test_with_args(third_way,ak,clear=False,*args):
    db = DbLib()
    secret = db.get_secret_by_ak(ak)
    api = UserRequest(mode,secret=secret)
    custom = {}
    third_way_dict = {
        '1':WEIBO_LOGIN_INFO,
        '2':QQ_LOGIN_INFO,
        '3':WECHAT_LOGIN_INFO,
        '4':custom
    }
    third_info = third_way_dict[str(third_way)]
    platform = third_info['platform']
    uid = third_info['uid']
    screen_name = third_info['screen_name']
    profile_image_url = third_info['profile_image_url']
    userinfo = api.openid_login(platform,uid,screen_name,profile_image_url,*args)
    if clear==True or clear == 'True':
        clear_result = user_clear(userinfo)
        assert clear_result
    return userinfo