*** Settings *** Library Collections Library RequestsLibrary Library DatabaseLibrary Library urllib3 Library ExcelLibrary *** Test Cases *** Traders_Login #代理商web端登录 #验证码登录 Disable Warnings Create Session traders ${uecclient} ${ztbsc_traders_login_header} ${Data} Set Variable { \ \ \ \ "account":"${papermill_account}", \ \ \ \ "accountType":2, \ \ \ \ "captcha":"${papermill_password}", \ \ \ \ "$loginType":"telphone", \ \ \ \ "$isNextAutoLogin":true } ${reps} POST On Session traders uec/authorize/by-captcha ${Data.encode('utf-8')} ${traders_token} Get From Dictionary ${reps.json()['data']} token #获取uectoken Set Global Variable ${traders_token} #转换业务token Create Session ZTBT ${ztbclient} ${ztbsc_traders_login_header} ${loginToken} Set Variable { \ \ \ \ "loginToken":"${traders_token}", \ \ \ \ "$configs":{ \ \ \ \ \ \ \ \ "$isBizFailedNotToast":true \ \ \ \ } } ${reps} Post On Session ZTBT ztb-user-enterprise-service/authorize/get/product-line-token/by/login-token ${loginToken.encode('utf-8')} ${T_userId} Get From Dictionary ${reps.json()["data"]} userId #获取用户id ${T_token} Get From Dictionary ${reps.json()["data"]} token #获取token Set Global Variable ${T_userId} Set Global Variable ${T_token} #Execl写入数据 Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\数据驱动.xls Put String To Cell ztbsc 3 17 {'Content-Type':'application/json','Authorization':'QNT ${T_token}','X-APP-ID':'503258978847966406','X-ORGANIZATION-ID':'721760754042277888'} #写入代理商端请求头数据 Save Excel DatadrivenT.xls #数据驱动 Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\DatadrivenT.xls ${ztbsc_traders_header} Read Cell Data By Name ztbsc D18 #代理商端header Set Global Variable ${ztbsc_traders_header} sleep 0.5 #获取用户组织信息 Create Session ZTBT ${ztbclient} ${ztbsc_traders_header} ${reps} GET On Session ZTBT ztb-supply-chain-service/get/agent/user-base-info ${TraderOrgInfoList} Get From Dictionary ${reps.json()['data']} agentOrgInfoList #用户代理商类型组织列表 FOR ${items} IN @{TraderOrgInfoList} ${trader_orgId} Get From Dictionary ${items} orgId #纸厂组织id ${trader_name} Get From Dictionary ${items} name #纸厂组织名称 Exit For Loop If '${trader_name}'=='${paperMillFinancialServiceProviderName}' END Set Global Variable ${trader_name} #Execl写入数据 Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\数据驱动.xls Put String To Cell ztbsc 3 17 {'Content-Type':'application/json','Authorization':'QNT ${T_token}','X-APP-ID':'503258978847966406','X-ORGANIZATION-ID':'${trader_orgId}'} #写入代理商端请求头数据 Save Excel DatadrivenTT.xls #数据驱动 Open Excel D:\\LYL\\Study\\Robot_framework\\New_Trading\\DatadrivenTT.xls ${ztbsc_traders_header} Read Cell Data By Name ztbsc D18 #代理商端header Set Global Variable ${ztbsc_traders_header} sleep 0.5 Agent_collection_list #代理商端收款管理 Create Session factoring ${ztbclient} ${ztbsc_traders_header} ${reps} GET On Session factoring ztb-supply-chain-service/user/get/receivable-order-page params=status=1&supplyChainInstanceId=${supplyChainInstanceId}&pageNum=1&pageSize=10 ${recycleId} Get From Dictionary ${reps.json()['data']['records'][0]} id #代理商收款id #代理商发起融资 ${TraderData} Set Variable { \ \ \ \ "idList":[ \ \ \ \ \ \ \ \ "${recycleId}" \ \ \ \ ] } ${reps} POST On Session factoring ztb-supply-chain-service/user/apply/packer/factoring ${TraderData.encode('utf-8')} Should Be Equal As Strings ${reps.json()['message']} successful