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.
81 lines
4.6 KiB
81 lines
4.6 KiB
*** Settings ***
|
|
Documentation 客户端登录
|
|
Library urllib3
|
|
Library Collections
|
|
Library RequestsLibrary
|
|
Library DatabaseLibrary
|
|
|
|
*** Test Cases ***
|
|
uec-login
|
|
#登录uec
|
|
#普通用户账号密码登录
|
|
Disable Warnings
|
|
Create Session factory ${uecClient} ${Client-LoginHeader}
|
|
${LoginData} Set Variable {"account":"${client_account}","captcha":"${client_password}","accountType":2}
|
|
${resp} POST On Session factory uec/authorize/by-captcha data=${LoginData}
|
|
${token} Get From Dictionary ${resp.json()["data"]} token #获取UECtoken
|
|
${userId} Get From Dictionary ${resp.json()["data"]} userId #获取用户id
|
|
Set Global Variable ${token}
|
|
Set Global Variable ${userId}
|
|
|
|
Login-token
|
|
#切换业务线token
|
|
Create Session factory ${yytClient} ${Client-LoginHeader}
|
|
#${Token} Create Dictionary loginToken=${token}
|
|
${Token} Set Variable {"loginToken":"${token}"}
|
|
${reps} POST On Session factory yyt-uec/authorize/get/product-line-token/by/login-token ${Token.encode('utf-8')}
|
|
${Token} Get From Dictionary ${reps.json()} data #获取业务线token
|
|
#Set Global Variable ${Token}
|
|
${client_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${Token}','X-APP-ID':'503258978847966422'} #移动端首次登录headerBaseInfo
|
|
Set Global Variable ${client_firstlogin_header}
|
|
|
|
BaseInfo
|
|
#获取用户基础信息
|
|
Create Session factory ${yytClient} ${client_firstlogin_header}
|
|
${reps} GET On Session factory yyt-uec/get/base-info params=userId=${userId}
|
|
${mobile} Get From Dictionary ${reps.json()["data"]} mobile #获取用户手机号
|
|
${organizationList} Get From Dictionary ${reps.json()["data"]} organizationList #获取用户组织列表
|
|
FOR ${OrgList} IN @{organizationList}
|
|
${factoryList} Get From Dictionary ${OrgList} factoryList #获取工厂列表
|
|
${enterpriseId} Get From Dictionary ${OrgList} enterpriseId #获取企业id
|
|
${organizationId} Get From Dictionary ${OrgList} organizationId #获取组织id
|
|
${serviceProviderId} Get From Dictionary ${OrgList} serviceProviderId #获取组织
|
|
Exit For Loop If '${organizationId}'=='723635193096835072' #723635193096835072普睿特组织id
|
|
END
|
|
FOR ${FList} IN @{factoryList}
|
|
${Fid} Get From Dictionary ${FList} id
|
|
Exit For Loop If '${Fid}'=='546450842056790018' #546450842056790018普睿特工厂id
|
|
END
|
|
${ClientHeader} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${Token}','X-APP-ID':'503258978847966422','X-FACTORY-ID':'${Fid}','X-ORGANIZATION-ID':'${organizationId}','X-PACKAGING-SERVICE-PROVIDER-ID':'${serviceProviderId}'} #获取组织信息的Header
|
|
#Run Keyword If '${mobile}'==null Run Keyword getPhone
|
|
Set Global Variable ${Fid}
|
|
Set Global Variable ${ClientHeader}
|
|
Set Global Variable ${enterpriseId}
|
|
Set Global Variable ${organizationId}
|
|
Set Global Variable ${serviceProviderId}
|
|
|
|
*** Keywords ***
|
|
UecLogin
|
|
Disable Warnings
|
|
Create Session factory ${uecClient} ${Client-LoginHeader}
|
|
${LoginData} Set Variable {"account":"${client_account}","captcha":"${client_password}","accountType":2}
|
|
${resp} POST On Session factory uec/authorize/by-captcha data=${LoginData}
|
|
${token} Get From Dictionary ${resp.json()["data"]} token #获取UECtoken
|
|
${userId} Get From Dictionary ${resp.json()["data"]} userId #获取用户id
|
|
Set Global Variable ${token}
|
|
Set Global Variable ${userId}
|
|
|
|
LoginToken
|
|
#切换业务线token
|
|
Create Session factory ${yytClient} ${Client-LoginHeader}
|
|
#${Token} Create Dictionary loginToken=${token}
|
|
${Token} Set Variable {"loginToken":"${token}"}
|
|
${reps} POST On Session factory yyt-uec/authorize/get/product-line-token/by/login-token ${Token.encode('utf-8')}
|
|
${Token} Get From Dictionary ${reps.json()} data #获取业务线token
|
|
#Set Global Variable ${Token}
|
|
${client_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'QNT ${Token}','X-APP-ID':'503258978847966422'} #移动端首次登录headerBaseInfo
|
|
Set Global Variable ${client_firstlogin_header}
|
|
|
|
getPhone
|
|
[Documentation] 无手机号获取手机号
|
|
#
|