feat:(v2版本接口)v2版本策略查询与策略新增keyword提交
This commit is contained in:
@@ -5,8 +5,28 @@ Library Collections
|
||||
Library RequestsLibrary
|
||||
|
||||
*** Keywords ***
|
||||
ManageApistr
|
||||
[Documentation]
|
||||
... 描述:入口,apistr 为调用api地址
|
||||
... 本关键字的作用是判断地址前有没有加版本号,如果没有加上
|
||||
... policy/compile -> /v1/policy/compile
|
||||
... /policy/compile -> /v1/policy/compile
|
||||
... v1/policy/compile -> /v1/policy/compile
|
||||
... /v1/policy/compile -> /v1/policy/compile
|
||||
[Arguments] ${apistr}
|
||||
${apiStart} Evaluate '${apistr}'[0:1]
|
||||
${apiStart1} Evaluate '${apistr}'[0:2]
|
||||
${apistr} Run Keyword If "${apiStart}"!="/" and "${apiStart}"!="v"
|
||||
... Set Variable /${version}/${apistr}
|
||||
... ELSE IF "${apiStart}"=="/" and "${apiStart1}"!="/v"
|
||||
... Set Variable /${version}${apistr}
|
||||
... ELSE IF "${apiStart}"=="v" Set Variable /${apistr}
|
||||
... ELSE IF "${apiStart1}"=="/v" Set Variable ${apistr}
|
||||
... ELSE Set Variable ${apistr}
|
||||
log ${apistr}
|
||||
[Return] ${apistr}
|
||||
BasePostRequest
|
||||
[Arguments] ${apistr} ${body}
|
||||
[Arguments] ${apistr} ${body}
|
||||
Set Headers {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
log 111111111111111111111111${apistr}
|
||||
&{httpResponse} Post ${apistr} ${body}
|
||||
@@ -16,7 +36,15 @@ BasePostRequest
|
||||
#Array $.data.policyList
|
||||
${response} Set Variable ${httpResponse.body}
|
||||
[Return] ${response}
|
||||
|
||||
BasePostRequestForV2
|
||||
[Arguments] ${requestUri} ${data} ${apiVersion}
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
create session api http://${host}:${port}/${apiVersion} ${headers}
|
||||
${response}= Post Request api ${requestUri} data=${data}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
${response} to json ${response.content}
|
||||
[Return] ${response}
|
||||
BaseGetRequest
|
||||
[Arguments] ${apistr} ${body}
|
||||
Set Headers {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
@@ -27,7 +55,15 @@ BaseGetRequest
|
||||
#Array $.data.policyList
|
||||
${response} Set Variable ${httpResponse.body}
|
||||
[Return] ${response}
|
||||
|
||||
BaseGetRequestForV2
|
||||
[Arguments] ${requestUri} ${data} ${apiVersion}
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
create session api http://${host}:${port}/${apiVersion} ${headers}
|
||||
${response}= Get Request api ${requestUri}?${data}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
${response} to json ${response.content}
|
||||
[Return] ${response}
|
||||
BaseDeleteRequest
|
||||
[Arguments] ${requestUri} ${data}
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
|
||||
Reference in New Issue
Block a user