From c1617f023cd48ba86e985256140f19b0582907b6 Mon Sep 17 00:00:00 2001 From: wangxin Date: Mon, 29 Jun 2020 11:08:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:(=E7=AD=96=E7=95=A5=E5=AF=BC=E5=85=A5)?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AD=96=E7=95=A5=E5=AF=BC=E5=85=A5=E6=9D=A1?= =?UTF-8?q?=E6=95=B0=E9=99=90=E5=88=B6=EF=BC=8C=E5=85=88=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=AF=BC=E5=85=A5=E6=B5=8B=E7=AD=96=E7=95=A5?= =?UTF-8?q?=E6=80=BB=E6=95=B0=EF=BC=8C=E7=84=B6=E5=90=8E=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=BE=85=E5=AF=BC=E5=85=A5=E7=9A=84=E7=AD=96=E7=95=A5=E6=80=BB?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=8C=E8=B6=85=E8=BF=87100=E4=B8=87?= =?UTF-8?q?=E6=9D=A1=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tsg_bfapi/policy_object/Policy.robot | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/02-Keyword/tsg_bfapi/policy_object/Policy.robot b/02-Keyword/tsg_bfapi/policy_object/Policy.robot index f61e597..bb8e113 100644 --- a/02-Keyword/tsg_bfapi/policy_object/Policy.robot +++ b/02-Keyword/tsg_bfapi/policy_object/Policy.robot @@ -110,7 +110,15 @@ ImportPolicy Directory Should Exist ${path} File Should Exist ${path}/${filePath}/${fileName} File Should Not Be Empty ${path}/${filePath}/${fileName} - ${size} Get File Size ${path}/${filePath}/${fileName} + #获取导入策略总数 + ${file} Get File ${path}/${filePath}/${fileName} + ${fileJson} json.Loads ${file} + #待导入的策略总数 + ${totalNum} Get From Dictionary ${fileJson} totalNum + #查询已经导入的非内置策略的数量 + ${totalExists} GetPolicyTotal 2 + ${calTotal} Evaluate ${totalNum} + ${totalExists} + Run Keyword If ${calTotal}>1000000 Fail 当前已经存在策略条数${totalExists},待导入条数${totalNum},总数超过100万条! ${binFile} Evaluate (r'import_policy.json',open(r"${path}/${filePath}/${fileName}",'rb'),'application/json') Log ${binFile} ${data} Create Dictionary policyType=${policyType} @@ -165,4 +173,16 @@ VerifyPolicies ${response} BasePostRequestForV2 /policy/verify ${body} ${version} ${rescode} Set Variable ${response['code']} Should Be Equal As Strings ${rescode} 200 - [Return] ${rescode} ${response['data']} \ No newline at end of file + [Return] ${rescode} ${response['data']} +GetPolicyTotal + [Documentation] + ... 获取已经存在的策略总量 + ... 排除内置策略 + ... initializeNum内置策略数量 + [Arguments] ${initializeNum} + ${response} BaseFormRequest ${policyUrl}/statistics ${EMPTY} ${version} + ${rescode} Set Variable ${response['code']} + Should Be Equal As Strings ${rescode} 200 + ${total} Set Variable ${response['data']['policyNum']} + ${total} Evaluate ${total} - ${initializeNum} + [Return] ${total} \ No newline at end of file