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.
87 lines
4.9 KiB
87 lines
4.9 KiB
*** Settings ***
|
|
Documentation 创建常规订单
|
|
Test Teardown Run Keyword If Test Failed Fatal Error
|
|
Test Timeout
|
|
Library RequestsLibrary
|
|
Library Collections
|
|
Library DateTime
|
|
Library urllib3
|
|
Library String
|
|
|
|
*** Variables ***
|
|
${header} {'content-type':'application/json','X-APP-ID':'470236309865238528','Authorization':'QNT ${gettoken}'}
|
|
${url} https://api-client-ztb-test.qniao.cn
|
|
|
|
*** Test Cases ***
|
|
get_paper-mill-city
|
|
#获取纸厂所在城市
|
|
Create Session ZTBT ${url} ${header}
|
|
${reps} Get On Session ZTBT recycle-service/get/paper-mill-city
|
|
${data} Get From Dictionary ${reps.json()} data #城市列表
|
|
FOR ${items} IN @{data}
|
|
${cityName} Get From Dictionary ${items} cityName #城市name
|
|
${cityId} Get From Dictionary ${items} cityId #城市id
|
|
Exit For Loop If '${cityName}'=='大同市'
|
|
END
|
|
Set Global Variable ${cityId}
|
|
|
|
get-factorylist
|
|
#获取代卖列表
|
|
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
|
|
Create Session factorylist http://api-client-ztb-test.qniao.cn ${header}
|
|
${reps} Get On Session factorylist recycle-service/get/paper-mill-paper-category-price-list params=cityId=${cityId}&enableSalesAgent=1&pageNum=1&pageSize=20&listType=0
|
|
Should Be Equal As Strings ${reps.json()["message"]} successful
|
|
${records} Get From Dictionary ${reps.json()["data"]} records #获取代卖纸厂列表
|
|
FOR ${item} IN @{records}
|
|
${name} Get From Dictionary ${item} name #获取纸厂name
|
|
${paperCategoryList} Get From Dictionary ${item} paperCategoryList #获取纸厂品类列表
|
|
${cumulativeWeight} Get From Dictionary ${item} cumulativeWeight #累计已代卖吨数
|
|
${paperMillId} Get From Dictionary ${item} paperMillId #获取纸厂id
|
|
${locProvinceName} Get From Dictionary ${item} locProvinceName #纸厂所在省
|
|
${locCityName} Get From Dictionary ${item} locCityName #纸厂所在市
|
|
${locDistrictName} Get From Dictionary ${item} locDistrictName #纸厂所在区
|
|
Exit For Loop If '${name}'=='Ceshi_factory'
|
|
END
|
|
${value} Evaluate random.choice(${paperCategoryList}) random
|
|
log to console \nvalue: ${value}
|
|
${categoryid} Get From Dictionary ${value} categoryId #纸厂品类id
|
|
${categoryName} Get From Dictionary ${value} categoryName #纸厂品类name
|
|
${unitPrice} Get From Dictionary ${value} unitPrice #纸厂品类价格
|
|
${paperMillAddress} Catenate ${locProvinceName} ${locCityName} ${locDistrictName}
|
|
Set Global Variable ${categoryid}
|
|
Set Global Variable ${unitPrice}
|
|
Set Global Variable ${paperMillId}
|
|
Set Global Variable ${paperMillAddress}
|
|
Set Global Variable ${categoryName}
|
|
Set Global Variable ${name}
|
|
|
|
get-carinfo
|
|
#获取使用过的车辆信息
|
|
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=${gettoken}
|
|
Create Session get-carinfo http://api-client-ztb-test.qniao.cn ${header}
|
|
${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 #获取车辆列表
|
|
${plateNumber1} Evaluate random.choice(${carNumber}) random
|
|
log to console \nvalue:${plateNumber1}
|
|
${plateNumber} Get From Dictionary ${plateNumber1} plateNumber #车辆信息
|
|
Set Global Variable ${plateNumber}
|
|
|
|
createorder
|
|
#创建下单
|
|
#${header} Create Dictionary content-type=application/json X-APP-ID=470236309865238528 Authorization=QNT ${gettoken}
|
|
${datatime} get current date result_format=%Y-%m-%d
|
|
#${DT} Add Time To Date ${datatime} -1 day
|
|
#${str} Get Substring ${DT} 0 10
|
|
log ${datatime}
|
|
${data} Set Variable {"paperCategoryId":"${categoryid}" ,"unitPrice":${unitPrice},"totalEstimatedWeight":30000,"customerName":"赖勇兰","deliveryTime":"${datatime}","carInfos":[{"plateNumber":"${plateNumber}"}]}
|
|
log ${data}
|
|
Create Session createorder http://api-client-ztb-test.qniao.cn ${header}
|
|
${reps} Post On Session createorder recycle-service/proxy-sell/create/order ${data.encode('utf-8')}
|
|
${orderId} Get From Dictionary ${reps.json()["data"]} orderId #获取订单编号
|
|
log ${reps.json()}
|
|
Should Be Equal As Strings ${reps.json()["message"]} successful
|
|
Set Global Variable ${datatime}
|
|
Set Global Variable ${orderId}
|
|
|
|
*** Keywords ***
|