This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/02-Keyword/tsg_bfapi/policy/ApiPolicyRequest.robot

62 lines
2.7 KiB
Plaintext
Raw Normal View History

2020-12-15 19:58:08 +08:00
*** 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}