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.
80 lines
4.8 KiB
80 lines
4.8 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'}
|
|
${psc_url} http://api-ops-psc-test.qniao.cn
|
|
|
|
*** Test Cases ***
|
|
get_contract_list
|
|
#获取生效中的合同列表
|
|
Create Session ZTBT ${URL} ${header}
|
|
${response} Get On Session ZTBT recycle-service/admin/contract/get/page-list params=pageNum=1&pageSize=10&status=1
|
|
log ${response.json()}
|
|
|
|
get_contract_by_paperMilldName
|
|
#通过纸厂查找合同
|
|
Create Session ZTBT ${URL} ${header}
|
|
${reps} Get On Session ZTBT recycle-service/admin/contract/get/page-list params=pageNum=1&pageSize=10&status=1&buyerEnterpriseId=${enterpriseId}
|
|
log ${reps.json()}
|
|
|
|
Seller_enterprise-list
|
|
#获取卖方企业列表
|
|
Create Session ZTBT ${psc_url} ${header}
|
|
${reps} Get On Session ZTBT payment-settlement-center/admin/supplier/get/enterprise-list/serarch-by-name-and-type
|
|
log ${reps.json()}
|
|
${data} Get From Dictionary ${reps.json()} data #获取企业列表
|
|
FOR ${items} IN @{data}
|
|
${sellerEnterpriseName} Get From Dictionary ${items} enterpriseName #卖方企业名称
|
|
${sellerEnterpriseId} Get From Dictionary ${items} enterpriseId #卖方企业id
|
|
${seller_id} Get From Dictionary ${items} id #企业标识符
|
|
Exit For Loop If '${enterpriseName}'=='企业'
|
|
END
|
|
Set Global Variable ${seller_id}
|
|
Set Global Variable ${sellerEnterpriseName}
|
|
Set Global Variable ${sellerEnterpriseId}
|
|
|
|
Buyer_enterprise-list
|
|
#获取买方企业列表
|
|
Create Session ZTBT ${psc_url} ${header}
|
|
${reps} Get On Session ZTBT payment-settlement-center/admin/supplier/get/enterprise-list/serarch-by-name-and-type
|
|
log ${reps.json()}
|
|
${data} Get From Dictionary ${reps.json()} data #获取企业列表
|
|
FOR ${items} IN @{data}
|
|
${buyerEnterpriseName} Get From Dictionary ${items} enterpriseName #买方企业名称
|
|
${buyerEnterpriseId} Get From Dictionary ${items} enterpriseId #买方企业id
|
|
${buyer_id} Get From Dictionary ${items} id #企业标识符
|
|
Exit For Loop If '${enterpriseName}'=='${paperMilld_name}'
|
|
END
|
|
Set Global Variable ${buyer_id}
|
|
Set Global Variable ${buyerEnterpriseName}
|
|
Set Global Variable ${buyerEnterpriseId}
|
|
|
|
buyer-paper-mill-categories_list
|
|
#买方纸厂品类
|
|
Create Session ZTBT ${URL} ${header}
|
|
${reps} Get On Session ZTBT recycle-service/admin/contract/get/buyer-paper-mill-categories/list params=enterpriseId=${enterpriseId}
|
|
log ${reps.json()}
|
|
${category_data} Get From Dictionary ${reps.json()} data #获取纸厂所有品类
|
|
${category_value} Evaluate random.choice(${category_data}) random #获取随机品类信息
|
|
log to console \nvalue: ${category_value}
|
|
${categoryId} Get From Dictionary ${category_value} categoryId #获取品类id
|
|
${categoryName} Get From Dictionary ${category_value} categoryName #品类名称
|
|
${paperMillId} Get From Dictionary ${category_value} paperMillId #纸厂id
|
|
Set Global Variable ${categoryId}
|
|
Set Global Variable ${categoryName}
|
|
Set Global Variable ${paperMillId}
|
|
|
|
create_contract
|
|
#创建纸厂合同
|
|
Create Session ZTBT ${URL} ${header}
|
|
${datatime} Get Current Date result_format=%Y-%m-%d
|
|
${New_DataTime} Add Time To Date ${datatime} 10 days
|
|
${str_time} Get Substring ${New_DataTime} 0 10
|
|
${data} Set Variable { \ \ \ \ "contractCategories":[ \ \ \ \ \ ], \ \ \ \ "limitLine":null, \ \ \ \ "accountPeriod":[ \ \ \ \ \ \ \ \ 30 \ \ \ \ ], \ \ \ \ "settleRules":0, \ \ \ \ "isSubsidyAndDeductIncludeTax":0, \ \ \ \ "settlePriceIncludeTaxSettleRules":0, \ \ \ \ "contractType":"0", \ \ \ \ "contractNo":"${datatime}合同", \ \ \ \ "accountPeriodType":0, \ \ \ \ "sellerEnterpriseId":"${sellerEnterpriseId}", \ \ \ \ "buyerEnterpriseId":"${buyerEnterpriseId}", \ \ \ \ "hasInvoice":1, \ \ \ \ "taxRefundRate":6.5, \ \ \ \ "startDate":"${datatime}", \ \ \ \ "endDate":"${str_time}", \ \ \ \ "signDateStart":"${datatime}", \ \ \ \ "signDateEnd":"${str_time}", \ \ \ \ "buyerEnterpriseName":"${buyerEnterpriseName}", \ \ \ \ "sellerEnterpriseName":"${sellerEnterpriseName}", \ \ \ \ "hasSubsidiesTax":0 }
|
|
${reps} Post On Session ZTBT recycle-service/admin/contract/create ${data.encode('utf-8')}
|
|
log ${reps.json()}
|