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.
 

44 lines
2.7 KiB

*** Settings ***
Documentation 运营端登录
Library urllib3
Library Collections
Library RequestsLibrary
*** Test Cases ***
uec-login
#账号密码登录获取UECtoken
Disable Warnings
Create Session opr-center ${uecClient} ${WOperation-LoginHeader}
${LoginData} Set Variable { \ \ \ \ "account":"${woperation_account}", \ \ \ \ "accountType":2, \ \ \ \ "captcha":"${woperation_password}", \ \ \ \ "$loginType":"telphone", \ \ \ \ "$isNextAutoLogin":true }
${reps} POST On Session opr-center uec/authorize/by-captcha ${LoginData.encode('utf-8')}
${Otoken} Get From Dictionary ${reps.json()['data']} token #获取UECtoken
${OuserId} Get From Dictionary ${reps.json()['data']} userId #获取用户id
Set Global Variable ${Otoken}
Set Global Variable ${OuserId}
Login-Token
#转换业务线token
Create Session opr-center ${yytClient} ${WOperation-LoginHeader}
${LoginData} Set Variable { \ \ \ \ "loginToken":"${Otoken}", \ \ \ \ "$configs":{ \ \ \ \ \ \ \ \ "$isBizFailedNotToast":true \ \ \ \ } }
${reps} POST On Session opr-center cloud-print-user-center/authorize/get/product-line-token/by/login-token ${LoginData.encode('utf-8')}
${LoginToken} Get From Dictionary ${reps.json()} data #获取业务线token
${operation_firstlogin_header} Set Variable {'Content-Type':'application/json','Authorization':'${LoginToken}','X-APP-ID':'503258978847966425'}
Set Global Variable ${LoginToken}
Set Global Variable ${operation_firstlogin_header}
base-info
#获取登录用户基础信息
Create Session opr-center ${yytClient} ${operation_firstlogin_header}
${reps} GET On Session opr-center yyt-uec/get/base-info
${organizationList} Get From Dictionary ${reps.json()['data']} organizationList #获取用户的组织列表
FOR ${List} IN @{organizationList}
${factoryId} Get From Dictionary ${List['factoryList'][0]} id #工厂id
${enterpriseId} Get From Dictionary ${List} enterpriseId #企业id
${organizationId} Get From Dictionary ${List} organizationId #组织id
Exit For Loop If '${enterpriseId}'=='723635193163943936' #普睿特企业id
END
${OperationHeader} Set Variable {'Content-Type':'application/json','Authorization':'${LoginToken}','X-APP-ID':'503258978847966425','X-Factory-Id':'${factoryId}','X-Organization-Id':'${organizationId}','X-Enterprise-Id':'${enterpriseId}'}
Set Global Variable ${factoryId}
Set Global Variable ${enterpriseId}
Set Global Variable ${organizationId}
Set Global Variable ${OperationHeader}