blob: aac867678d07b6e8c99ae873074c88b038a45fa9 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Library Collections
3Library RequestsLibrary
4Resource ../CommonKeywords/HttpRequest.robot
5Resource EngineAddr.robot
6
7*** Keywords ***
8deleteEngineRule
9 [Arguments] ${packageName} ${codeFlag}=1
10 [Documentation] ${packageName} :The data type is string!
11 ${headers} create dictionary Content-Type=application/json
12 create session microservices ${engineHost} ${headers}
13 ${deleteUrl} set variable ${engineUrl}/${packageName}
14 ${deleteResponse} delete request microservices ${deleteUrl}
15 log ${deleteResponse.content}
16 run keyword if ${codeFlag}==1 Should be equal as strings ${deleteResponse.status_code} 200
17 run keyword if ${codeFlag}!=1 Should be equal as strings ${deleteResponse.status_code} 499
18 [Return] ${deleteResponse}
19
20verifyEngineRule
21 [Arguments] ${checkContent} ${codeFlag}=1
22 ${response} httpPost ${engineHost} ${engineUrl} ${checkContent}
23 log ${response.content}
24 run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200
25 run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499
26 [Return] ${response}
27
28deployEngineRule
29 [Arguments] ${jsonParams} ${codeFlag}=1
30 ${response} httpPut ${engineHost} ${engineUrl} ${jsonParams}
31 log ${response.content}
32 run keyword if ${codeFlag}==1 Should be equal as strings ${response.status_code} 200
33 run keyword if ${codeFlag}!=1 Should be equal as strings ${response.status_code} 499
34 [Return] ${response}