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/01-TestCase/tsg_bfapi/setting/ResponsePagesPolicy.robot

139 lines
7.9 KiB
Plaintext
Raw Normal View History

2020-06-01 19:32:46 +08:00
*** Settings ***
Test Teardown TeardownDelete ${url} profileIds ${profileId}
Force Tags tsg_bf_api Response_Pages
Library String
Library OperatingSystem
Library Selenium2Library
Library Collections
Resource ../../../02-Keyword/tsg_bfapi/Common.robot
Resource ../../../02-Keyword/tsg_bfapi/policy_file_interface/FunctionalKeywords.robot
Resource ../../../03-Variable/BifangApiVariable.txt
Resource ../../../02-Keyword/tsg_adc/SystemCommand.robot
Resource ../../../02-Keyword/tsg_bfapi/PolicyObject.robot
Resource ../../../02-Keyword/tsg_bfapi/LogVariable.robot
Resource ../../../02-Keyword/tsg_bfapi/ApiRequest.robot
Resource ../../../03-Variable/AllFlowCaseVariable.txt
Resource ../../../03-Variable/Policy_Objects_Module.txt
Library Custometest
*** Variables ***
${url} /v1/policy/profile/responsepages
2020-06-01 19:32:46 +08:00
${profileId} ${EMPTY}
*** Test Cases ***
Response_page_html-00001
#Hijack 需要修改的内容
${objectedit} Create Dictionary profileName=zmminserttest format=html
Comment 打印需要修改的json内容
log ${objectedit}
${objectDict} Jsoneditmanu ${setting_proxy_profiles_reponse_page} ${objectedit}
log ${objectDict}
${response} CreatePolicyFile4 ${url} response_pages_files/ Create-Response Pages-test.html ${objectDict}
# 查询
${profileId} Get From Dictionary ${response} profileId
${profileName} Get From Dictionary ${response} profileName
QueryPolicyFile ${url} profileId=${profileId}&profileName=${profileName}
# 修改
${header_edit} Set Variable {"isValid":1,"format":"html","opAction":"update","profileName":"test_edit","profileId":"${profileId}","returnData":1}
UpdatePolicyFile ${url} response_pages_files/ Create-Response Pages-test.html ${header_edit}
Response_page_html-00002
#Hijack 需要修改的内容
${objectedit} Create Dictionary profileName=%E6%9C%B1bright%D1%8F%D1%81%D0%BD%D1%8B%D0%B9 format=html
Comment 打印需要修改的json内容
log ${objectedit}
${objectDict} Jsoneditmanu ${setting_proxy_profiles_reponse_page} ${objectedit}
log ${objectDict}
${response} CreatePolicyFile4 ${url} response_pages_files/ Create-Response Pages-test.html ${objectDict}
# 查询
${profileId} Get From Dictionary ${response} profileId
${profileName} Get From Dictionary ${response} profileName
QueryPolicyFile ${url} profileId=${profileId}&profileName=${profileName}
# 修改
${header_edit} Set Variable {"isValid":1,"format":"html","opAction":"update","profileName":"test_edit","profileId":"${profileId}","returnData":1}
UpdatePolicyFile ${url} response_pages_files/ Create-Response Pages-test.html ${header_edit}
Response_page_html-Namelong1_00003
#Hijack 需要修改的内容
${objectedit} Create Dictionary profileName=1 format=html
Comment 打印需要修改的json内容
log ${objectedit}
${objectDict} Jsoneditmanu ${setting_proxy_profiles_reponse_page} ${objectedit}
log ${objectDict}
${response} CreatePolicyFile4 ${url} response_pages_files/ Create-Response Pages-test.html ${objectDict}
# 查询
${profileId} Get From Dictionary ${response} profileId
${profileName} Get From Dictionary ${response} profileName
QueryPolicyFile ${url} profileId=${profileId}&profileName=${profileName}
# 修改
${header_edit} Set Variable {"isValid":1,"format":"html","opAction":"update","profileName":"test_edit","profileId":"${profileId}","returnData":1}
UpdatePolicyFile ${url} response_pages_files/ Create-Response Pages-test.html ${header_edit}
Response_page_html-Namelong128_00004
#Hijack 需要修改的内容
${objectedit} Create Dictionary profileName=12311233333333333333333333333333333qweeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee3333333333333333333333131312312321313 format=html
Comment 打印需要修改的json内容
log ${objectedit}
${objectDict} Jsoneditmanu ${setting_proxy_profiles_reponse_page} ${objectedit}
log ${objectDict}
${response} CreatePolicyFile4 ${url} response_pages_files/ Create-Response Pages-test.html ${objectDict}
# 查询
${profileId} Get From Dictionary ${response} profileId
${profileName} Get From Dictionary ${response} profileName
QueryPolicyFile ${url} profileId=${profileId}&profileName=${profileName}
# 修改
${header_edit} Set Variable {"isValid":1,"format":"html","opAction":"update","profileName":"test_edit","profileId":"${profileId}","returnData":1}
UpdatePolicyFile ${url} response_pages_files/ Create-Response Pages-test.html ${header_edit}
2020-07-21 11:10:24 +08:00
Response_page_html-Policy_references-00005
# 创建文件对象
${objectedit} Create Dictionary profileName=zmminserttest format=html
Comment 打印需要修改的json内容
log ${objectedit}
${objectDict} Jsoneditmanu ${setting_proxy_profiles_reponse_page} ${objectedit}
log ${objectDict}
${response} CreatePolicyFile4 ${url} response_pages_files/ Create-Response Pages-test.html ${objectDict}
# 查询
${profiledId} Get From Dictionary ${response} profileId
# 创建策略
Comment 创建目标IP
${objectDict} Create Dictionary objectType=ip isValid=${1} addItemList=CIDR|192.168.100.5|32|0/0
${rescode} ${objectId} AddObject2 ${1} ${objectDict}
${objectids} set Variable ${objectId}
Comment 创建url
${objectDict} Create Dictionary objectType=url isValid=${1} addItemList=$open.node.com/test/xiaozhu/xiaozhu.html
${rescode} ${object_url_Id} AddObject2 ${1} ${objectDict}
${objectids} Catenate SEPARATOR=, ${objectids} ${object_url_Id}
Comment 创建请求头
${objectDict} Create Dictionary objectType=http_signature isValid=${1} addItemList=$Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML like Gecko) Chrome/31.0.1650.63 Safari/537.36|User-Agent
${rescode} ${object_UA_Id} AddObject2 ${1} ${objectDict}
${objectids} Catenate SEPARATOR=, ${objectids} ${object_UA_Id}
#创建引用文件
${response} CreatePolicyFile2 ${url} ${responsePageFiles} 404china.html resPages
${profiledId} Get From Dictionary ${response} profileId
Comment 创建安全策略
${policyDict} Create Dictionary policyName=SecurityPolicy-Deny-HTTP-00034 policyType=tsg_security policyDesc=autotest userTags= action=deny effectiveRange= userRegion={"protocol":"HTTP","method":"alert","code":200,"html_profile":${profiledId}} referenceObject=${object_url_Id}|TSG_FIELD_HTTP_URL isValid=${1} appObjectIdArray=2
${rescode} ${policyId} AddPolicy2 ${1} ${policyDict}
#删除策略
${policyIds} Create List {"policyType":"tsg_security","policyIds":[${policyId}]}
# 删除对象 失败
${response} BaseDeleteRequest /${version}/policy/profile/responsepages {"profileIds":[${profiledId}]}
${response_code} Get From Dictionary ${response} code
#log aaaaaaaaaa:${response_code}
Should Be Equal As Strings ${response_code} 40090030
# 删除策略
DeletePolicyAndObject ${policyIds} ${objectids}
# 删除对象 成功
${response} BaseDeleteRequest /${version}/policy/profile/responsepages {"profileIds":[${profiledId}]}
${response_code} Get From Dictionary ${response} code
#log aaaaaaaaaa:${response_code}
Should Be Equal As Strings ${response_code} 200