纸通宝交易版
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.
 
 

74 lines
4.4 KiB

*** Settings ***
Library DateTime
Library Collections
Library RequestsLibrary
*** Variables ***
${url} http://api-client-ztb-test.qniao.cn
${headers} {'content-type':'application/json','X-APP-ID':'470236309865238528','Authorization':'QNT ${gettoken}'}
*** Test Cases ***
proxy-sell-activity_list
#获取活动代卖列表
Create Session ZTBT ${url} ${headers}
${repsponse} Get On Session ZTBT recycle-service/proxy-sell-activity/list params=pageNum=1&pageSize=15
${records} Get From Dictionary ${repsponse.json()["data"]} records #获取代卖活动列表
FOR ${item} IN @{records}
${activityName} Get From Dictionary ${item} activityName #获取活动名称
${paperCategoryList} Get From Dictionary ${item} paperCategoryList #获取纸厂品类
${paperMillId} Get From Dictionary ${item} paperMillId #获取纸厂id
${activityId} Get From Dictionary ${item} activityId #获取活动id
Exit For Loop If '${activityName}'=='Ceshi_factory--两次'
END
${Category_value} Evaluate random.choice(${paperCategoryList}) random #获取纸品
log to console \nvalue: ${Category_value}
${categoryId} Get From Dictionary ${Category_value} categoryId #获取纸品id
${categoryName} Get From Dictionary ${Category_value} categoryName #获取纸品名称
${unitPrice} Get From Dictionary ${Category_value} unitPrice #获取纸品价格
Set Global Variable ${paperMillId}
Set Global Variable ${activityId}
Set Global Variable ${categoryId}
Set Global Variable ${categoryName}
Set Global Variable ${unitPrice}
get-carinfo
#获取使用过的车辆信息
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
Create Session get-carinfo ${url} ${headers}
${reps} Get On Session get-carinfo recycle-service/proxy-sell/get/his-car-info
log ${reps.json()}
${carNumber} Get From Dictionary ${reps.json()["data"]} records #车辆列表
${plateNumber_value} Evaluate random.sample(${carNumber},1) random
log to console \nvalue:${plateNumber_value}
${plateNumber1} Get From Dictionary ${plateNumber_value[0]} plateNumber #车辆信息1
#${plateNumber2} Get From Dictionary ${plateNumber_value[1]} plateNumber #车辆信息2
Set Global Variable ${plateNumber1}
#Set Global Variable ${plateNumber2}
get_paper-mill-paper-category-price-details
#获取纸厂详情
Create Session ZTBT ${url} ${headers}
${reps} Get On Session ZTBT recycle-service/get/paper-mill-paper-category-price-details/${paperMillId}
log ${reps.json()}
get_relation
#创建用户和业务归属人关系
Create Session ZTBT ${url} ${headers}
${reps} Get On Session ZTBT recycle-service/proxy-sell/get/relation
${bizUserId} Get From Dictionary ${reps.json()["data"]} bizUserId #业务归属人id
${cusormerId} Get From Dictionary ${reps.json()["data"]} cusormerId #用户id
${customerName} Get From Dictionary ${reps.json()["data"]} customerName #用户名称
Set Global Variable ${bizUserId}
Set Global Variable ${cusormerId}
Set Global Variable ${customerName}
create_order
#创建代卖活动订单-2次付款
Create Session ZTBT ${url} ${headers}
${datatime} get current date result_format=%Y-%m-%d
${order_data} Set Variable { \ \ \ \ "paperCategoryId":"${categoryId}", \ \ \ \ "unitPrice":"${unitPrice}", \ \ \ \ "totalEstimatedWeight":30000, \ \ \ \ "activityId":"${activityId}", \ \ \ \ "customerName":"${customerName}", \ \ \ \ "deliveryTime":"${datatime}", \ \ \ \ "carInfos":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "plateNumber":"${plateNumber1}" \ \ \ \ \ \ \ \ } \ \ \ \ ] }
${reps} Post On Session ZTBT recycle-service/proxy-sell/create/order ${order_data.encode('utf-8')}
log ${reps.json()}
${orderId} Get From Dictionary ${reps.json()["data"]} orderId #获取订单编号
Should Be Equal As Strings ${reps.json()["message"]} successful
Set Global Variable ${orderId}