*** Settings *** Test Teardown Run Keyword If Test Failed Fatal Error Library RequestsLibrary Library Collections Library urllib3 *** Variables *** &{cloud_factory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 ${uecclient} https://api-client-uec-test.qniao.cn ${yytclient} https://api-client-yyt-test.qniao.cn *** Test Cases *** customer_phone #去除警告 Disable Warnings #创建会话 会话别名 baseurl headers Create Session uecclient ${uecclient} headers=${cloud_factory_customer_header} #变量名称 设置用例变量 变量值 ${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号 ${account} Set Variable 13012345678 ${body} Set Variable {"accountType":${accounttype},"account":"${account}","captcha":"888888"} #变量接收响应结果 post请求 会话别名 uri 传参 ${response} POST On Session uecclient /uec/authorize/by-captcha ${body} #日志 Log ${response.status_code} #日志 Log ${response.text} #日志 Log ${response.json()} #断言数字 预期结果 实际结果 Should Be Equal As Numbers 200 ${response.status_code} #断言字符串 预期结果 实际结果 Should Be Equal As Strings successful ${response.json()["message"]} #变量接收token 获取字典内容 响应结果 token-key ${gettoken_customer} Get From Dictionary ${response.json()["data"]} token #日志 log ${gettoken_customer} #设置token变量 未转业务线 Set Suite Variable ${gettoken_customer} #变量接收客户userid 获取字典内容 响应结果 userid-key ${userid_customer} Get From Dictionary ${response.json()["data"]} userId #日志 log ${userid_customer} #设置token变量 Set Suite Variable ${userid_customer} #设置带token的请求头 &{cloudfactorycustomerheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer} #设置token变量 Set Suite Variable ${cloudfactorycustomerheader} customer_login_token Disable Warnings Create Session yytclient ${yytclient} headers=${cloudfactorycustomerheader} ${body} Set Variable {"loginToken":"${gettoken_customer}"} ${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")} Log ${response.status_code} Log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} #Should Be Equal As Strings successful ${response.json()["message"]} ${getlogintoken_customer} Get From Dictionary ${response.json()} data log ${getlogintoken_customer} #全局token Set Global Variable ${getlogintoken_customer} #&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer} &{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer} Set Suite Variable ${cloudfactory_customer_header} get_customer_userinfo Create Session uecclient ${uecclient} headers=${cloudfactory_customer_header} ${response} Get On Session uecclient /uec/get/user-info Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} Should Be Equal As Integers ${userid_customer} ${response.json()["data"]["userId"]} #Should Be Equal As Integers 0 ${response.json()["data"]["employeeStatus"]} #员工状态 0 启用 1停用 get_customer_baseinfo Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header} ${response} Get On Session yytclient cloud-print-user-center/get/base-info Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} #Should Be Equal As Integers 0 ${response.json()["data"]["employeeStatus"]} #员工状态 0 启用 1停用 get_customer_useridentity Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header} ${response} Get On Session yytclient cloud-print-user-center/get/user/identity Log ${response.status_code} log ${response.json()} Should Be Equal As Numbers 200 ${response.status_code} Should Be Equal As Strings successful ${response.json()["message"]} #Should Be Equal As Integers 3 ${response.json()["data"]["type"]} #身份 0无企业用户 1印包未开户 2印包已开户 3印包已授信 4原纸未开户 5原纸已开户 6原纸集采商