云印通原纸商城
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.
 
 

95 lines
5.4 KiB

*** Settings ***
Test Teardown
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}
Set Suite Variable ${cloudfactory_customer_header}
customer_get_credit_password_status
Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header}
${response} Get On Session yytclient /cloud-print-user-center/credit/payment-password/getstatus
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 Strings False ${response.json()["data"]["setPassword"]} #设置密码状态 True已设置 False未设置
customer_save_credit_password
Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header}
${customer_credit_password} Set Variable 123456
${save_creditpassword_type} Set Variable 0 #操作状态 0增加密码 1修改密码
${body} Set Variable {"oldPassword":"","newPassword":"${customer_credit_password}","repeatPassword":"${customer_credit_password}","status":${save_creditpassword_type}}
${response} POST On Session yytclient /cloud-print-user-center/credit/payment-password/save ${body.encode("utf8")}
Set Suite Variable ${customer_credit_password}
log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
customer_update_credit_password
Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header}
${customer_credit_password_new} Set Variable 123456
${save_creditpassword_type} Set Variable 1 #操作状态 0增加密码 1修改密码
${body} Set Variable {"oldPassword":"${customer_credit_password}","newPassword":"${customer_credit_password_new}","repeatPassword":"${customer_credit_password_new}","status":${save_creditpassword_type}}
${response} POST On Session yytclient /cloud-print-user-center/credit/payment-password/save ${body.encode("utf8")}
log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
Set Global Variable ${customer_credit_password_new}