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

59 lines
3.8 KiB

*** Settings ***
Library RequestsLibrary
Library Collections
Library DateTime
*** Variables ***
${header} {'X-APP-ID':'470236309865238555','Authorization':'Token 6b08add42d6bcf73abb935b2adf83525','Content-Type':'application/json'}
${URL} http://api-ops-ztb-test.qniao.cn
*** Test Cases ***
reservation-list
#${header} Create Dictionary X-APP-ID=470236309865238555 Authorization=Token 6b08add42d6bcf73abb935b2adf83525
#获取预约列表信息
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps_data} Get On Session ZTBT recycle-service/admin/customer-service/get/paper-mill-order-reservation-list params=pageNum=1&pageSize=20&status=
log ${reps_data.json()}
#获取订单编号${orderId}、纸厂id${paperMillId}、订单类型${orderType}
${orderId} Get From Dictionary ${reps_data.json()["data"]["records"][0]} orderId #订单编号
${paperMillId} Get From Dictionary ${reps_data.json()["data"]["records"][0]} paperMillId #纸厂id
${id} Get From Dictionary ${reps_data.json()["data"]["records"][0]} id #预约id
${orderType} Get From Dictionary ${reps_data.json()["data"]["records"][0]} orderType #订单类型
${carNoList} Get From Dictionary ${reps_data.json()["data"]["records"][0]} carNoList #车辆信息
${paperMillName} Get From Dictionary ${reps_data.json()["data"]["records"][0]} paperMillName #纸厂名称
${sellerReservationDate} Get From Dictionary ${reps_data.json()["data"]["records"][0]} sellerReservationDate #送货时间
#随机获取车辆信息
${carList} Evaluate random.choice(${carNoList}) random
log to console \nvalue:${carList}
Should Be Equal As Strings ${reps_data.json()["message"]} successful
Set Global Variable ${orderId} ${paperMillId} ${id} ${paperMillName} ${sellerReservationDate} ${orderType} ${carList}
get-factory-list
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-list params=pageNum=1&pageSize=20&name=
${id} Get From Dictionary ${reps.json()["data"]["records"][0]} id
log ${id}
Set Suite Variable ${id}
get-supplier
Create Session ZTBT http://api-ops-ztb-test.qniao.cn ${header}
${reps} Get On Session ZTBT recycle-service/admin/customer-service/get/paper-mill-merchant/${paperMillId} params=paperMillId=${paperMillId}
log ${reps.json()}
#获取供应商id和name
${data} Get From Dictionary ${reps.json()} data
${value} Evaluate random.choice(${data}) random
log to console \nvalue: ${value}
${supplier_id} Get From Dictionary ${value} id #供应商id
${millSupplierName} Get From Dictionary ${value} name #供应商名称
Set Suite Variable ${supplier_id}
Set Suite Variable ${millSupplierName}
Submit-appointment
#${headers} Create Dictionary Content-Type=application/json X-APP-ID=470236309865238555 Authorization=Token 6b08add42d6bcf73abb935b2adf83525
#提交预约信息
Create Session ZTBT ${URL} ${header}
${datatime} get current date result_format=%Y-%m-%d
${data} Set Variable {"attention":"${orderId}","buyerReservationDate":"${datatime}", "id":"${id}","millDeliveryOrderId":"${orderId}","millSupplierId":"${supplier_id}","millSupplierName":"${millSupplierName}","proxySellerSettleType":1,"scrapeOrderId":"${orderId}"}
log ${data}
${reps} Post On Session ZTBT recycle-service/admin/customer-service/update/reservation ${data.encode('utf-8')}
Should Be Equal As Strings ${reps.json()["message"]} successful