纸通宝交易版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

48 lines
2.2 KiB

*** Settings ***
Library RequestsLibrary
Library Collections
Library urllib3
Library DatabaseLibrary
*** Variables ***
${header} {'content-type':'application/json','X-APP-ID':'470236309865238528'}
${url} http://api-client-ztb-test.qniao.cn
*** Test Cases ***
userlogin
[Setup]
#验证码登录
Disable Warnings
Create Session ZTBT https://api-client-uec-test.qniao.cn ${header}
${data} Create Dictionary account=18888888888 captcha=888888 accountType=2
${account} Set Variable 18888888888
#${data} Set Variable {"accountType":2,"account":"${account}","captcha":888888}
${respones} POST On Session ZTBT uec/authorize/by-captcha json=${data}
log ${respones.status_code}
log ${respones.json()}
${token} Get From Dictionary ${respones.json()["data"]} token
Set Global Variable ${token}
Set Global Variable ${account}
[Teardown]
login-token
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528
Create Session ZTBT ${url} ${header}
${token1} Create Dictionary loginToken=${token}
${reps} Post On Session ZTBT recycle-user-center/authorize/get/product-line-token/by/login-token json=${token1}
${gettoken} Get From Dictionary ${reps.json()["data"]} token #获取token
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
log ${reps.json()["data"]["token"]}
Set Global Variable ${gettoken}
Set Global Variable ${userId}
getuserinfo
#获取用户信息
${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session baseinfo ${url} ${header}
${reps} Get On Session baseinfo recycle-service/user/get/base-info
${realName} Get From Dictionary ${reps.json()["data"]} realName #获取实名
${userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id
Set Global Variable ${realName}
Set Global Variable ${userId}
Should Be Equal As Strings ${account} ${reps.json()["data"]["mobile"]}