*** Settings *** Library RequestsLibrary Library Collections Library urllib3 Library DateTime Library String *** Test Cases *** create_delegation #创建委托 #获取委托方组织列表 Create Session auction ${uecops} ${ztbsc_header} ${reps} GET On Session auction uec/admin/get/organization-list params=pageNum=1&pageSize=300&keyword= ${records} Get From Dictionary ${reps.json()['data']} records #委托方组织列表 ${auctionOrgInfo} Evaluate random.choice(${records}) random ${auctionFullName} Get From Dictionary ${auctionOrgInfo} fullName #委托方组织名称 #获取委托方组织 ${reps} GET On Session auction uec/admin/get/organization-list params=pageNum=1&pageSize=30&keyword=${auctionFullName} ${fullName} Get From Dictionary ${reps.json()['data']['records'][0]} fullName #委托方组织名称 ${orgId} Get From Dictionary ${reps.json()['data']['records'][0]} id #委托方组织id Set Global Variable ${fullName} #创建委托拍品 ${autionData} Set Variable { \ \ \ \ "auctionEntrustDto":{ \ \ \ \ \ \ \ \ "contact":"小小", \ \ \ \ \ \ \ \ "contactNumber":"15014242835", \ \ \ \ \ \ \ \ "entrustTime":"${time}", \ \ \ \ \ \ \ \ "orgId":"${orgId}" \ \ \ \ }, \ \ \ \ "auctionLotDto":{ \ \ \ \ \ \ \ \ "address":"重庆", \ \ \ \ \ \ \ \ "lotDescribe":"黄废", \ \ \ \ \ \ \ \ "name":"一级纸(黄废)" \ \ \ \ } } ${reps} POST On Session auction auction-service/admin/create/auction ${autionData.encode('utf-8')} Should Be Equal As Strings ${reps.json()['message']} successful #委托拍品列表 ${reps} GET On Session auction auction-service/admin/page/auction params=status=&pageNum=1&pageSize=10 ${List} Get From Dictionary ${reps.json()['data']} records #委托拍品列表 FOR ${items} IN @{List} ${auctionEntrustId} Get From Dictionary ${items} auctionEntrustId #委托拍品id ${auctionSellerOrgName} Get From Dictionary ${items} auctionSellerOrgName #委托组织名称 Exit For Loop If '${auctionSellerOrgName}'=='${fullName}' END Set Global Variable ${auctionEntrustId} auction_detail #拍品详情 Create Session auction ${uecops} ${ztbsc_header} ${reps} GET On Session auction auction-service/admin/get/auction/detail/${auctionEntrustId} ${auctionId} Get From Dictionary ${reps.json()['data']} auctionId #拍品唯一标识 ${displayName} Get From Dictionary ${reps.json()['data']} displayName #拍品名称 ${auctionLotId} Get From Dictionary ${reps.json()['data']} auctionLotId ${displayAddress} Get From Dictionary ${reps.json()['data']} displayAddress #拍品地 ${displayDescribe} Get From Dictionary ${reps.json()['data']} displayDescribe #拍品描述 ${auctionId} Set Variable If '${auctionId}'=='${None}' null ${auctionId} #修改拍品设置 #上传图片 Disable Warnings ${image} Evaluate open('./标的1-6.jpg','rb') ${filepath} Evaluate open('./标的1-6.jpg','rb') ${file} Create Dictionary filepath=${filepath} image=${image} Create Session auction ${ztbops} ${reps} POST On Session auction recycle-user-center/upload/image files=${file} ${pictures} Get From Dictionary ${reps.json()} data #上传MP4文件 #${file} Evaluate open('./5e7f47fb6aea3.mp4','rb') #${file_data} Create Dictionary file=${file} #${type_data} Create Dictionary type='mp4' #Create Session auction ${ztbops} #${reps} POST On Session auction recycle-user-center/upload/file data=${type_data} files=${fileData} #${MP4Data} Get From Dictionary ${reps.json()} data #Set Global Variable ${MP4Data} #sleep 0.5 #保存拍品设置 Create Session auction ${uecops} ${ztbsc_header} ${quantity} Evaluate round(random.uniform(2,30),2) random #拍卖重量(吨) ${auctionData} Set Variable { \ \ \ \ "auctionLotImageList":[ \ \ \ \ \ \ \ \ { \ \ \ \ \ \ \ \ \ \ \ \ "url":"${pictures}", \ \ \ \ \ \ \ \ \ \ \ \ "type":1 \ \ \ \ \ \ \ \ }], \ \ \ \ "displayDescribe":"${displayDescribe}", \ \ \ \ "displayAddress":"${displayAddress}", \ \ \ \ "displayName":"${displayName}", \ \ \ \ "quantity":${quantity}, \ \ \ \ "id":"${auctionLotId}" } ${reps} POST On Session auction auction-service/admin/modify/auction-lot ${auctionData.encode('utf-8')} Should Be Equal As Strings ${reps.json()['message']} successful #设置拍品规则 #随机获取竞拍人员 ${reps} GET On Session auction auction-service/admin/page/auction-bidder params=pageNum=1&pageSize=30&keyword=&depositPaymentStatus=1 ${List} Create List ${Bidders} Get From Dictionary ${reps.json()['data']} records #竞拍人员列表 FOR ${items} IN @{Bidders} ${id} Get From Dictionary ${items} id #竞拍人员id Append To List ${List} {"id":"${id}"} END ${Num} Evaluate random.randint(1,6) random #获取随机数字 ${bidders_List} Evaluate random.sample(${List},${Num}) random #获取多个竞拍人员id ${BList} Convert To String ${bidders_List} ${BiddersList} Replace String Using Regexp ${BList} ' ${EMPTY} #获取时间 ${time} Get Current Date result_format=%Y-%m-%d %H:%M:00 #获取当前时间 ${start_time} Add Time To Date ${time} 00:05:00 #获取未来两小时 ${start_time} Get Substring ${start_time} 0 19 #截取正常时间时间 ${end_time} Add Time To Date ${time} 1 day #获取第二天当前时间 #${end_time} Add Time To Date ${time} 00:10:00 ${end_time} Get Substring ${end_time} 0 19 #截取正常时间时间 #保存拍品规则 ${bidScale} Evaluate random.randint(1,10) random #加价幅度 ${startingPrice} Evaluate random.randint(1000,2000) random #起拍价(元/吨) ${addDelayTime} Evaluate random.randint(1,5) random #延期时间(分钟) ${Auction_rules} Set Variable { \ \ \ \ "auctionBidderDtoList":${BiddersList}, \ \ \ \ "auctionLotDto":{ \ \ \ \ \ \ \ \ "startingPrice":"${startingPrice}", \ \ \ \ \ \ \ \ "id":"${auctionLotId}" \ \ \ \ }, \ \ \ \ "auctionDto":{ \ \ \ \ \ \ \ \ "id":"${auctionId}", \ \ \ \ \ \ \ \ "auctionEntrustId":"${auctionEntrustId}", \ \ \ \ \ \ \ \ "bidOptions":"${bidScale},${bidScale},${bidScale},${bidScale}", \ \ \ \ \ \ \ \ "bidScale":"${bidScale}", \ \ \ \ \ \ \ \ "endTime":"${end_time}", \ \ \ \ \ \ \ \ "startTime":"${start_time}", \ \ \ \ \ \ \ \ "addDelayStatus":true, \ \ \ \ \ \ \ \ "addDelayTime":"${addDelayTime}" \ \ \ \ } } ${reps} POST On Session auction auction-service/admin/modify/auction-rule ${Auction_rules.encode('utf-8')} Should Be Equal As Strings ${reps.json()['message']} successful #委托拍品列表 ${reps} GET On Session auction auction-service/admin/page/auction params=status=&pageNum=1&pageSize=10 ${List} Get From Dictionary ${reps.json()['data']} records #委托拍品列表 FOR ${items} IN @{List} ${isDown} Get From Dictionary ${items} isDown #拍品上、下架状态 ${auctionId} Get From Dictionary ${items} auctionId #竞拍唯一标识 ${auctionSellerOrgName} Get From Dictionary ${items} auctionSellerOrgName #委托组织名称 Exit For Loop If '${auctionSellerOrgName}'=='${fullName}' END ${isDown} Set Variable If '${isDown}'=='${true}' false true #上架拍品 ${PutonAuction} Set Variable { \ \ \ \ "id":"${auctionId}", \ \ \ \ "isDown":${isDown}} ${reps} POST On Session auction auction-service/admin/operate/auction ${PutonAuction.encode('utf-8')} Should Be Equal As Strings ${reps.json()['message']} successful