62 lines
2.7 KiB
Plaintext
62 lines
2.7 KiB
Plaintext
*** Settings ***
|
||
Library Collections
|
||
Library RequestsLibrary
|
||
Resource ../../../03-Variable/BifangApiVariable.txt
|
||
Resource ../../common/ApiHttpRequest.robot
|
||
Variables ../../../05-Other/variable/policy/apipolicyrequesttest.py
|
||
|
||
*** Variables ***
|
||
${policyapiv2} /v2/policy/compile
|
||
${objectapiv1} /v1/policy/object
|
||
${hosturl} http://${host}:${port}
|
||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||
*** Keywords ***
|
||
GetRequestResposeCodePrivate
|
||
[Arguments] ${data}
|
||
[Documentation] [Get方法封装:第二层,]
|
||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||
${response} GetRequestBase http://${hosturl}:${port} ${policyapiv2} ${header} ${data}
|
||
${response} to json ${response}
|
||
${code} get from dictionary ${response} code
|
||
[Return] ${code}
|
||
|
||
GetPolicyData
|
||
[Arguments] ${host} ${api} ${header} ${data} ${returnKey}
|
||
[Documentation] [Get方法封装:第二层,]
|
||
${response} GetRequestBase ${hosturl} ${policyapiv2} ${header} ${data}
|
||
${response} to json ${response}
|
||
${returnValue} get from dictionary ${response} ${returnKey}
|
||
[Return] ${returnValue}
|
||
|
||
AddPolicyData
|
||
[Arguments] ${data} ${returnKey}
|
||
[Documentation] [Get方法封装:第二层,]
|
||
${response} PostRequestBase ${hosturl} ${policyapiv2} ${header} ${data}
|
||
${response} to json ${response}
|
||
${returnValue} get from dictionary ${response} ${returnKey}
|
||
[Return] ${returnValue}
|
||
|
||
AddObjectData
|
||
[Arguments] ${data} ${returnKey}
|
||
[Documentation] [Get方法封装:第二层,]
|
||
${response} PostHttpRequestBase ${hosturl} ${objectapiv1} ${header} ${data}
|
||
${response} to json ${response}
|
||
${returnValue} get from dictionary ${response} ${returnKey}
|
||
[Return] ${returnValue}
|
||
|
||
AddPolicyBase
|
||
[Arguments] ${host} ${api} ${header} ${body}
|
||
${header} Create Dictionary Content-Type=application/json Authorization=${token}
|
||
Create Session api ${hosturl} headers=${header}
|
||
${remoteResponse} Post Request api ${api} data=${body}
|
||
[Return] ${remoteResponse.content}
|
||
|
||
AddPolicyCode
|
||
[Arguments] ${host} ${api} ${header} ${data}
|
||
[Documentation] [Get方法封装:第二层,]
|
||
${response} PostRequestBase ${hosturl} ${api} ${header} ${data}
|
||
${response} to json ${response}
|
||
${code} get from dictionary ${response} code
|
||
[Return] ${code}
|
||
|