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

139 lines
9.1 KiB

*** Settings ***
Library DateTime
Library Collections
Library RequestsLibrary
Library String
*** Variables ***
${URL} http://api-ops-ztb-test.qniao.cn
${header} {'X-APP-ID':'470236309865238555','Authorization':'${gettoken}','Content-Type':'application/json'}
*** Test Cases ***
proxy-sell-activity_list
#代卖活动列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/proxy-sell-activity/list params=pageNum=1&pageSize=10&status=1
${records} Get From Dictionary ${reps.json()["data"]} records #代卖活动列表
${value} Evaluate random.choice(${records}) random
log to console \nvalue: ${value}
${settlementModes} Get From Dictionary ${value} settlementModes #代卖活动结算方式
${settlementMode} Set Variable If '${settlementModes}'=='1' 1 0
Set Global Variable ${settlementMode}
get_paper-mill-list
#获取纸厂列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-list params=pageNum=1&pageSize=30&enableSalesAgent=1
${records} Get From Dictionary ${reps.json()["data"]} records #获取纸厂列表
FOR ${items} IN @{records}
${shortName} Get From Dictionary ${items} shortName #纸厂简称
${PaperMillId} Get From Dictionary ${items} id #纸厂id
Exit For Loop If '${shortName}'=='宇茂纸业'
END
Set Global Variable ${shortName}
Set Global Variable ${PaperMillId}
factory-licence-list
#纸厂企业对照表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-user-center/admin/get/factory-licence-list params=pageNum=1&pageSize=30
get-Transaction subject
#获取交易主体
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/transaction-main-enterprise/list
${交易数据} Get From Dictionary ${reps.json()} data
#随机获取交易主体
${交易信息} Evaluate random.choice(${交易数据}) random
log to console \nvalue:${交易信息}
${交易主体id} Get From Dictionary ${交易信息} id #交易主体id
${交易主体name} Get From Dictionary ${交易信息} name #交易主体name
Set Global Variable ${交易主体id}
Set Global Variable ${交易主体name}
user_search
#参与用户
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/proxy-sell-activity/user/search
${data} Get From Dictionary ${reps.json()} data #用户列表
FOR ${items} IN @{data}
${userId} Get From Dictionary ${items} userId #用户id
${phone} Get From Dictionary ${items} phone #用户手机号
Exit For Loop If '${phone}'=='15014242835'
END
Set Global Variable ${userId}
get_paper-mill-category
#获取纸厂品类
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/paperMill/get/paper-mill-category/${PaperMillId}
${data} Get From Dictionary ${reps.json()} data #纸厂品类列表
${value} Evaluate random.choice(${data}) random
log to console \nvalue: ${value}
${categoryName} Get From Dictionary ${value} categoryName #品类名称
${paperMillCategoryId} Get From Dictionary ${value} paperMillCategoryId #品类id
Set Global Variable ${categoryName}
Set Global Variable ${paperMillCategoryId}
get_mill-supplier-list
#获取纸厂供应商列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/get/mill-supplier-list/${PaperMillId}
${data} Get From Dictionary ${reps.json()} data #供应商列表
${supplier_value} Evaluate random.choice(${data}) random
log to console \nvalue: ${supplier_value}
${account} Get From Dictionary ${supplier_value} account #供应商名称
${merchantAccountId} Get From Dictionary ${supplier_value} merchantAccountId #供应商id
Set Global Variable ${account}
Set Global Variable ${merchantAccountId}
Upload_pictures
#上传本地图片
#${dict} Create Dictionary Content-Type=image/jpeg filename=20210803.jpg
#Create Session ZTBT ${URL} ${dict}
${filepath} Evaluate open('E:/lyl/图片/21042217001449712.png','rb')
${image} Evaluate open('E:/lyl/图片/21042217001449712.png','rb')
${file} Create Dictionary filepath=${filepath} image=${image}
Create Session ZTBT ${URL}
log ${file}
${result} Post On Session ZTBT recycle-user-center/upload/image files=${file}
${pictures} Get From Dictionary ${result.json()} data
log ${result.content}
Set Global Variable ${pictures}
saveOrUpdate-2
#新增代卖活动(2次)
Create Session ZTBT ${URL} ${header}
${datatime} Get Time
${DT} Add Time To Date ${datatime} 2 days
${DT_str} Get Substring ${DT} 0 19
${activity_data} Set Variable { \ \ \ \ "id":null, \ \ \ \ "activityName":"${shortName}-两次", \ \ \ \ "paperMillId":"${PaperMillId}", \ \ \ \ "millSupplierId":"${merchantAccountId}", \ \ \ \ "settlementModes":1, \ \ \ \ "tradeOwnerName":"${交易主体name}", \ \ \ \ "tradeOwnerId":"${交易主体id}", \ \ \ \ "isEntire":0, \ \ \ \ "agreedDeliveryWeight":100000, \ \ \ \ "ruleUrl":"${pictures}", \ \ \ \ "paperMillPaperCategoriesList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategoryId":"${paperMillCategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategoryPrice":1.23, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategorySubsidyPrice":0.01 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "activityId":null, \ \ \ \ "users":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "userId":"${userId}", \ \ \ \ \ \ \ \ \ \ \ \ "paymentModes":1, \ \ \ \ \ \ \ \ \ \ \ \ "surcharge":0.015 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "factorys":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "factoryId":null, \ \ \ \ \ \ \ \ \ \ \ \ "paymentModes":0, \ \ \ \ \ \ \ \ \ \ \ \ "surcharge":0 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "startTime":"${datatime}", \ \ \ \ "endTime":"${DT_str}" }
${reps} Post On Session ZTBT recycle-service/admin/proxy-sell-activity/saveOrUpdate ${activity_data.encode('utf-8')}
saveOrUpdate-1
#新增代卖活动(1次)
Create Session ZTBT ${URL} ${header}
${datatime} Get Time
${DT} Add Time To Date ${datatime} 2 days
${DT_str} Get Substring ${DT} 0 19
${activity_data} Set Variable { \ \ \ \ "id":null, \ \ \ \ "activityName":"${shortName}-一次", \ \ \ \ "paperMillId":"${PaperMillId}", \ \ \ \ "millSupplierId":"${merchantAccountId}", \ \ \ \ "settlementModes":0, \ \ \ \ "tradeOwnerName":"${交易主体name}", \ \ \ \ "tradeOwnerId":"${交易主体id}", \ \ \ \ "isEntire":0, \ \ \ \ "agreedDeliveryWeight":100000, \ \ \ \ "ruleUrl":"${pictures}", \ \ \ \ "paperMillPaperCategoriesList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategoryId":"${paperMillCategoryId}", \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategoryPrice":1.33, \ \ \ \ \ \ \ \ \ \ \ \ "paperMillPaperCategorySubsidyPrice":0.015 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "activityId":null, \ \ \ \ "users":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "userId":"${userId}", \ \ \ \ \ \ \ \ \ \ \ \ "paymentModes":1, \ \ \ \ \ \ \ \ \ \ \ \ "surcharge":0.02 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "factorys":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "factoryId":null, \ \ \ \ \ \ \ \ \ \ \ \ "paymentModes":0, \ \ \ \ \ \ \ \ \ \ \ \ "surcharge":0 \ \ \ \ \ \ \ \ } \ \ \ \ ], \ \ \ \ "startTime":"${datatime}", \ \ \ \ "endTime":"${DT_str}" }
${reps} Post On Session ZTBT recycle-service/admin/proxy-sell-activity/saveOrUpdate ${activity_data.encode('utf-8')}
proxy-sell-activity_list1
#代卖活动列表
Create Session ZTBT ${URL} ${header}
${reps} Get On Session ZTBT recycle-service/admin/proxy-sell-activity/list params=pageNum=1&pageSize=10&status=1
${records} Get From Dictionary ${reps.json()["data"]} records #活动列表
FOR ${items} IN @{records}
${Activity_id} Get From Dictionary ${items} id #获取活动id
${activityName} Get From Dictionary ${items} activityName #获取活动名称
Exit For Loop If '${activityName}'=='${shortName}-一次'
END
Set Global Variable ${Activity_id}
shutActivity
#结束活动
Create Session ZTBT ${URL} ${header}
${data} Set Variable {"activityId":"${Activity_id}"}
${reps} Post On Session ZTBT recycle-service/admin/proxy-sell-activity/shutActivity ${data.encode('utf-8')}
Should Be Equal As Strings ${reps.json()["message"]} successful