导入导出功能自动化,对象txt格式导入导出,策略txt和json格式导入,txt格式导出

This commit is contained in:
hebingning
2020-12-24 20:02:22 +08:00
parent 2443be3579
commit b11b2a654d
4 changed files with 836 additions and 86 deletions

View File

@@ -119,18 +119,25 @@ ImportPolicy
#待导入的策略总数
${totalNum} Get From Dictionary ${fileJson} totalNum
#查询已经导入的非内置策略的数量
${totalExists} GetPolicyTotal 2
${totalExists} GetPolicyTotal 10
${calTotal} Evaluate ${totalNum} + ${totalExists}
Connect To Database Using Custom Params pymysql ${mysqlHost}
${policyLimit} query SELECT cfg_value FROM t_sys_cfg WHERE cfg_name='policy_upper_limit'
${policyLimit} Set Variable ${policyLimit[0][0]}
${remaining} Evaluate ${policyLimit}-${totalExists}
log 策略剩余可导入量为:${remaining}
${testType} Evaluate type($policyLimit)
Disconnect From Database
#jira CHON-12导入限制需求支持
Run Keyword If ${calTotal}>1000000 Fail 当前已经存在策略条数${totalExists},待导入条数${totalNum},总数超过100万条!
Run Keyword If ${calTotal}>${policyLimit} log 当前已经存在策略条数${totalExists},待导入条数${totalNum},总数超过${policyLimit}条!
${binFile} Evaluate (r'import_policy.json',open(r"${path}/${filePath}/${fileName}",'rb'),'application/json')
Log ${binFile}
${data} Create Dictionary policyType=${policyType}
${file} Create Dictionary file=${binFile}
${response} BaseMultipartPostRequest ${policyUrl}/batch ${data} ${file} ${version}
${response} BaseMultipartPostRequest ${policyUrl}/batch ${data} ${file} ${version2}
${rescode} Set Variable ${response['code']}
Should Be Equal As Strings ${rescode} 200
[Return] ${rescode}
[Return] ${rescode} ${totalNum}
ExportPolicy
[Documentation]
... 策略导出