Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for Deployment verification |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify Deployment functionality |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
| 8 | Library XML |
| 9 | Library RequestsLibrary |
| 10 | Library ../Framework/utils/utils.py |
| 11 | Library ../Framework/restApi.py |
| 12 | |
| 13 | *** Variables *** |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 14 | ${PATHFILE} ${CURDIR}/data/Ch_Deployment.json |
| 15 | ${PATHFILE2} ${CURDIR}/data/putDeployment.json |
| 16 | |
| 17 | *** Test Cases *** TYPE LISTINDEX |
| 18 | Test Post Deployment-1 |
| 19 | CREATE 0 |
| 20 | |
| 21 | Test Get Deployment-1 |
| 22 | RETRIEVE 0 |
| 23 | #Test Edit Deployment-1 PUT 0 |
| 24 | |
| 25 | Test Delete Deployment-1 |
| 26 | DELETE 0 |
| 27 | |
| 28 | Test Post Deployment-2 |
| 29 | CREATE 1 |
| 30 | |
| 31 | Test Get Deployment-2 |
| 32 | RETRIEVE 1 |
| 33 | #Test Edit Deployment-2 PUT 1 |
| 34 | |
| 35 | Test Delete Deployment-2 |
| 36 | DELETE 1 |
| 37 | |
| 38 | *** Keywords *** |
| 39 | Read InputFile |
| 40 | ${deploymentList}= utils.jsonToList ${PATHFILE} DeploymentInfo |
| 41 | Set Suite Variable ${dlist} ${deploymentList} |
| 42 | ${putDeploymentList}= utils.jsonToList ${PATHFILE2} DeploymentInfo |
| 43 | Set Suite Variable ${putList} ${putDeploymentList} |
| 44 | |
| 45 | Verify Deployment functionality |
| 46 | [Arguments] ${type} ${listIndex} |
| 47 | Run Keyword If "${type}" == "CREATE" Test Post Deployment API ${listIndex} |
| 48 | Run Keyword If "${type}" == "RETRIEVE" Test Get Deployment API ${listIndex} |
| 49 | Run Keyword If "${type}" == "PUT" Test Edit Deployment API ${listIndex} |
| 50 | Run Keyword If "${type}" == "DELETE" Test Delete Deployment API ${listIndex} |
| 51 | |
| 52 | Test Post Deployment API |
| 53 | [Arguments] ${listIndex} |
| 54 | ${deploymentList} = Get Variable Value ${dlist} |
| 55 | ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex} |
| 56 | ${api_result}= restApi.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict} |
| 57 | Should Be True ${api_result} |
| 58 | |
| 59 | Test Get Deployment API |
| 60 | [Arguments] ${listIndex} |
| 61 | ${json_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS |
| 62 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 63 | Log ${json_result_list} |
| 64 | ${deploymentList}= Get Variable Value ${dlist} |
| 65 | ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex} |
| 66 | ${name}= utils.getFieldValueFromDict ${deploymentDict} name |
| 67 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} name ${name} |
| 68 | ${test_result}= utils.compare_dict ${deploymentDict} ${getJsonDict} |
| 69 | Should Be True ${test_result} |
| 70 | |
| 71 | Test Edit Deployment API |
| 72 | [Arguments] ${listIndex} |
| 73 | ${get_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS |
| 74 | ${putDeploymentList}= Get Variable Value ${putList} |
| 75 | ${putDeploymentDict}= utils.listToDict ${putDeploymentList} ${listIndex} |
| 76 | ${name}= utils.getFieldValueFromDict ${putDeploymentDict} name |
| 77 | ${deploymentDict}= utils.getDictFromListofDict ${get_result} name ${name} |
| 78 | ${deploymentID}= utils.getFieldValueFromDict ${deploymentDict} id |
| 79 | ${api_result}= restApi.ApiPut CH_CORE_DEPLOYMENTS ${putDeploymentDict} ${deploymentID} |
| 80 | Should Be True ${api_result} |
| 81 | ${getResultAfterPut}= restApi.ApiGet CH_CORE_DEPLOYMENTS ${deploymentID} |
| 82 | ${test_result}= utils.compare_dict ${putDeploymentDict} ${getResultAfterPut} |
| 83 | Should Be True ${test_result} |
| 84 | |
| 85 | Test Delete Deployment API |
| 86 | [Arguments] ${listIndex} |
| 87 | ${json_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS |
| 88 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 89 | ${deploymentList}= Get Variable Value ${dlist} |
| 90 | ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex} |
| 91 | ${name}= utils.getFieldValueFromDict ${deploymentDict} name |
| 92 | Log ${name} |
| 93 | ${deploymentDict}= utils.getDictFromListofDict ${json_result_list} name ${name} |
| 94 | Log ${deploymentDict} |
| 95 | ${deploymentId}= utils.getFieldValueFromDict ${deploymentDict} id |
| 96 | Log ${deploymentId} |
| 97 | ${test_result}= restApi.ApiChameleonDelete CH_CORE_DEPLOYMENTS ${deploymentId} |
| 98 | Should Be True ${test_result} |