*** Settings *** Documentation 实名认证 Library Collections Library RequestsLibrary *** Variables *** ${URL} http://api-client-uec-test.qniao.cn ${header} {'content-type':'application/json','X-APP-ID':'470236309865238528','Authorization':'${gettoken}'} *** Test Cases *** identity-auth-session #创建身份认证对话 Create Session ZTBT ${URL} ${header} ${reps} Get On Session ZTBT uec/create/identity-auth-session log ${reps.json()} ${token} Get From Dictionary ${reps.json()["data"]} token #临时token ${userId} Get From Dictionary ${reps.json()["data"]} userId #用户id Set Global Variable ${token} Set Global Variable ${userId} certificate-img #上传身份证图片 ${filepath1} Set Variable E:/lyl/图片/20210805134405.jpg ${frontImg} Evaluate base64.b64encode(open('${filepath1}','rb').read()).decode('utf-8') base64 log ${frontImg} ${filepath2} Set Variable E:/lyl/图片/20210805134412.jpg ${backImg} Evaluate base64.b64encode(open('${filepath2}','rb').read()).decode('utf-8') base64 log ${backImg} Create Session ZTBT ${URL} ${header} log ${frontImg} ${data} Set Variable { \ \ \ \ "identityAuthToken":"${token}", \ \ \ \ "frontImg":{ \ \ \ \ \ \ \ \ "base64":"${frontImg}", \ \ \ \ \ \ \ \ "type":"jpg" \ \ \ \ }, \ \ \ \ "backImg":{ \ \ \ \ \ \ \ \ "base64":"${backImg}", \ \ \ \ \ \ \ \ "type":"jpg" \ \ \ \ } } ${result} Post On Session ZTBT uec/recognize/certificate-img ${data.encode('utf-8')} log ${result.json()} ${certificateNo} Get From Dictionary ${result.json()["data"]} certificateNo #获取身份证号 ${realName} Get From Dictionary ${result.json()["data"]} realName #获取持卡人姓名 ${identityAuthToken} Get From Dictionary ${result.json()["data"]} identityAuthToken #身份认证token Set Global Variable ${certificateNo} Set Global Variable ${realName} Set Global Variable ${identityAuthToken} identity #身份认证 Create Session ZTBT ${URL} ${header} ${data} Set Variable {"realName":"${realName}","certificateNo":"${certificateNo}","identityAuthToken":"${identityAuthToken}"} ${reps} Post On Session ZTBT uec/identify/identity ${data.encode('utf-8')} log ${reps.json()} Should Be Equal As Strings ${reps.json()["message"]} successful