feat:(策略对象)1:策略对象删除;2:策略对象导入;3:策略对象导出
This commit is contained in:
@@ -181,4 +181,18 @@ BasePostRequestReturnBinary
|
||||
${response} Post Request api ${requestUri} data=${data}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
[Return] ${response.content}
|
||||
BaseGetRequestReturnBinary
|
||||
[Documentation]
|
||||
... 下载文件专用
|
||||
... 返回二进制数据
|
||||
[Arguments] ${requestUri} ${data} ${apiVersion}
|
||||
Log Call BasePostRequestReturnBinary
|
||||
${headers} set variable {"Authorization":"${token}","Content-Type":"application/json"}
|
||||
${dataString} Dictionary-To-QueryParams ${data}
|
||||
create session api http://${host}:${port}/${apiVersion} ${headers}
|
||||
Log ${data}
|
||||
${response} Get Request api ${requestUri}?${dataString}
|
||||
log return data =${response}
|
||||
Should Be Equal As Strings ${response.status_code} 200
|
||||
[Return] ${response.content}
|
||||
@@ -69,4 +69,61 @@ GetObjectItems
|
||||
FOR ${item} IN @{data['list']}
|
||||
Append To List ${itemIds} ${item['itemId']}
|
||||
END
|
||||
[Return] ${rescode} ${itemIds} ${data['list']}
|
||||
[Return] ${rescode} ${itemIds} ${data['list']}
|
||||
DeleteObjects
|
||||
[Documentation]
|
||||
... 删除策略对象
|
||||
... params,传入的删除字典
|
||||
... 结构为[1,2,3]
|
||||
[Arguments] ${objectIds}
|
||||
${type} Evaluate isinstance(${objectIds},list)
|
||||
Should Be True ${type}
|
||||
${dict} Create Dictionary objectIds=${objectIds}
|
||||
${json} json.Dumps ${dict} ensure_ascii=False
|
||||
${response} BaseDeleteRequest /${version}${objectUrl} ${json}
|
||||
${rescode} Set Variable ${response['code']}
|
||||
Should Be Equal As Strings ${rescode} 200
|
||||
[Return] ${rescode}
|
||||
ImportObject
|
||||
[Documentation]
|
||||
... 策略对象导入
|
||||
... filePath文件路径
|
||||
... fileName文件名称
|
||||
... objectType对象类型
|
||||
... objectSubType对象子类型
|
||||
... objectName对象名称
|
||||
[Arguments] ${filePath} ${fileName} ${objectType} ${objectSubType} ${objectName}
|
||||
Directory Should Exist ${path}
|
||||
File Should Exist ${path}/${filePath}/${fileName}
|
||||
File Should Not Be Empty ${path}/${filePath}/${fileName}
|
||||
${size} Get File Size ${path}/${filePath}/${fileName}
|
||||
Should Not Be Empty ${objectType}
|
||||
${objectSubType} Run Keyword If "${objectType}"=="ip" and "${objectSubType}"=="${EMPTY}" Set Variable endpoint
|
||||
... ELSE Set Variable ${objectSubType}
|
||||
${subfix} Fetch From Right ${fileName} .
|
||||
${binFile} Run Keyword If "${subfix}"=="txt" Evaluate (r'${fileName}',open(r"${path}/${filePath}/${fileName}",'rb'),'text/plain')
|
||||
... ELSE IF "${subfix}"=="csv" Evaluate (r'${fileName}',open(r"${path}/${filePath}/${fileName}",'rb'),'application/vnd.ms-excel')
|
||||
... ELSE ${EMPTY}
|
||||
${data} Create Dictionary objectType=${objectType}
|
||||
Run Keyword If "${objectSubType}"!="${EMPTY}" Set To Dictionary ${data} objectSubType=${objectSubType}
|
||||
Run Keyword If "${objectName}"!="${EMPTY}" Set To Dictionary ${data} objectName=${objectName}
|
||||
${file} Create Dictionary file=${binFile}
|
||||
${response} BaseMultipartPostRequest ${objectUrl}/batch ${data} ${file} ${version}
|
||||
${rescode} Set Variable ${response['code']}
|
||||
Should Be Equal As Strings ${rescode} 200
|
||||
[Return] ${rescode}
|
||||
ExportObject
|
||||
[Documentation]
|
||||
... 策略对象导出
|
||||
... objectType ip,url等
|
||||
... objectSubType 子类型
|
||||
... objectIds 1,2,3
|
||||
... objectName 字符串
|
||||
[Arguments] ${objectType} ${objectSubType} ${objectIds} ${objectName}
|
||||
Should Not Be Empty ${objectType}
|
||||
${params} Create Dictionary objectType=${objectType}
|
||||
Run Keyword If "${objectSubType}"!="${EMPTY}" Set To Dictionary ${params} objectSubType=${objectSubType}
|
||||
Run Keyword If "${objectIds}"!="${EMPTY}" Set To Dictionary ${params} objectIds=${objectIds}
|
||||
Run Keyword If "${objectName}"!="${EMPTY}" Set To Dictionary ${params} objectName=${objectName}
|
||||
${response} BaseGetRequestReturnBinary ${objectUrl}/batch ${params} ${version}
|
||||
[Return] ${response}
|
||||
Reference in New Issue
Block a user