83 lines
4.1 KiB
Plaintext
83 lines
4.1 KiB
Plaintext
*** Settings ***
|
||
Test Teardown TeardownDelete ${url} profileIds ${profileId}
|
||
Force Tags tsg_adc Security_Policy
|
||
Library OperatingSystem
|
||
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/hijackfiles
|
||
${profileId} ${EMPTY}
|
||
|
||
*** Test Cases ***
|
||
Hijack_file_24_type-hijack
|
||
#Hijack
|
||
${objectedit} Create Dictionary profileName=Hijack_file_24_type-00000 contentName=Create-Hijack Files-test-0.apk contentType=application/vnd.android.package-archive
|
||
${response} settings ${objectedit} hijack
|
||
|
||
Hijack_file_24_type-insert
|
||
#insert
|
||
${objectedit} Create Dictionary profileName=zmminserttest format=js insertOn=before_page_load contentName=Create-Insert Scripts-test-1.js
|
||
${response} settings ${objectedit} insert
|
||
|
||
Hijack_file_24_type-response
|
||
#insert
|
||
${objectedit} Create Dictionary profileName=zmminserttest format=js insertOn=before_page_load
|
||
${response} settings ${objectedit} response
|
||
|
||
*** Keywords ***
|
||
ProfileComman1
|
||
[Arguments] ${objectedit} ${type}
|
||
${default_json} ${default_files} ${default_url} Run Keyword If "${type}"=="hijack" Set Variable ${setting_proxy_profiles_hijack} hijack_files/ /policy/profile/hijackfiles
|
||
... ELSE IF Run Keyword If "${type}"=="insert" Set Variable ${setting_proxy_profiles_insert} insert_files/ /policy/profile/insertfiles
|
||
... ELSE Set Variable a b c
|
||
${objectDict} Jsoneditmanu ${default_json} ${objectedit}
|
||
log ${objectDict}
|
||
${response} CreatePolicyFile4 ${default_url} ${default_files} ${objectDict}
|
||
[Return] ${response}
|
||
|
||
settings
|
||
[Arguments] ${dict} ${type}
|
||
#创建3个列表,代表不同的接口类型
|
||
@{Interface_file} create list hijack insert
|
||
@{Interface_post} create list claimedsrcip Reflector
|
||
@{Interface_ceri} create list keyring TrustedCertPolicy
|
||
#创建3个返回值用于接口参数
|
||
${setting_json} catenate SEPARATOR= setting_proxy_profiles_ ${type}
|
||
log ${setting_json}
|
||
${setting_file} catenate SEPARATOR= ${type} _files /
|
||
log ${setting_file}
|
||
${setting_url} catenate SEPARATOR= /policy/profile/ ${type} files
|
||
log ${setting_url}
|
||
${response} Run Keyword If "${type}" in @{Interface_file} Interface_file ${setting_json} ${setting_url} ${setting_file} ${dict}
|
||
... ELSE IF Run Keyword If ${type}in @{Interface_post} Interface_post ${setting_json} ${setting_url} ${dict}
|
||
... ELSE IF Run Keyword If ${type}in @{Interface_ceri} Interface_Ceri ${setting_url} ${setting_file} ${dict}
|
||
log ${response}
|
||
|
||
Interface_file
|
||
[Arguments] ${setting_json} ${setting_url} ${setting_file} ${dict}
|
||
${file_name} Set Variable ${dict}[contentName]
|
||
${objectDict} Jsoneditmanu ${${setting_json}} ${dict}
|
||
${response} CreatePolicyFile4 ${setting_url} ${setting_file} ${file_name} ${objectDict}
|
||
[Return] ${response}
|
||
|
||
Interface_post
|
||
[Arguments] ${setting_json} ${setting_url} ${dict}
|
||
${objectDict} Jsoneditmanu ${setting_json} ${dict}
|
||
${response} Post-Request ${setting_url} ${objectDict}
|
||
[Return] ${response}
|
||
|
||
Interface_Ceri
|
||
[Arguments] ${setting_url} ${setting_file} ${dict}
|
||
${file_name} Set Variable ${dict}[0]
|
||
${file1} Set Variable ${dict}[1]
|
||
${file2} Set Variable ${dict}[2]
|
||
${TypeCeri} Set Variable ${dict}[3]
|
||
${response} CreatePolicyMutipartFile ${setting_url} ${setting_file} ${file1} ${file2} ${TypeCeri}
|
||
[Return] ${response}
|