Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library RequestsLibrary |
| 4 | Resource ../CommonKeywords/HttpRequest.robot |
| 5 | Resource EngineAddr.robot |
| 6 | |
| 7 | *** Keywords *** |
| 8 | deleteEngineRule |
| 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 | |
| 20 | verifyEngineRule |
| 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 | |
| 28 | deployEngineRule |
| 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} |