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 |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 10 | Library CORDRobot |
| 11 | Library ImportResource resources=CORDRobot |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 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 |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 40 | ${deploymentList}= CORDRobot.jsonToList ${PATHFILE} DeploymentInfo |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 41 | Set Suite Variable ${dlist} ${deploymentList} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 42 | ${putDeploymentList}= CORDRobot.jsonToList ${PATHFILE2} DeploymentInfo |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 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} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 55 | ${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex} |
| 56 | ${api_result}= CORDRobot.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 57 | Should Be True ${api_result} |
| 58 | |
| 59 | Test Get Deployment API |
| 60 | [Arguments] ${listIndex} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 61 | ${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 62 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 63 | Log ${json_result_list} |
| 64 | ${deploymentList}= Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 65 | ${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex} |
| 66 | ${name}= CORDRobot.getFieldValueFromDict ${deploymentDict} name |
| 67 | ${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list} name ${name} |
| 68 | ${test_result}= CORDRobot.compare_dict ${deploymentDict} ${getJsonDict} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 69 | Should Be True ${test_result} |
| 70 | |
| 71 | Test Edit Deployment API |
| 72 | [Arguments] ${listIndex} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 73 | ${get_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 74 | ${putDeploymentList}= Get Variable Value ${putList} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 75 | ${putDeploymentDict}= CORDRobot.listToDict ${putDeploymentList} ${listIndex} |
| 76 | ${name}= CORDRobot.getFieldValueFromDict ${putDeploymentDict} name |
| 77 | ${deploymentDict}= CORDRobot.getDictFromListofDict ${get_result} name ${name} |
| 78 | ${deploymentID}= CORDRobot.getFieldValueFromDict ${deploymentDict} id |
| 79 | ${api_result}= CORDRobot.ApiPut CH_CORE_DEPLOYMENTS ${putDeploymentDict} ${deploymentID} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 80 | Should Be True ${api_result} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 81 | ${getResultAfterPut}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS ${deploymentID} |
| 82 | ${test_result}= CORDRobot.compare_dict ${putDeploymentDict} ${getResultAfterPut} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 83 | Should Be True ${test_result} |
| 84 | |
| 85 | Test Delete Deployment API |
| 86 | [Arguments] ${listIndex} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 87 | ${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 88 | ${json_result_list}= Get From Dictionary ${json_result} items |
| 89 | ${deploymentList}= Get Variable Value ${dlist} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 90 | ${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex} |
| 91 | ${name}= CORDRobot.getFieldValueFromDict ${deploymentDict} name |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 92 | Log ${name} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 93 | ${deploymentDict}= CORDRobot.getDictFromListofDict ${json_result_list} name ${name} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 94 | Log ${deploymentDict} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 95 | ${deploymentId}= CORDRobot.getFieldValueFromDict ${deploymentDict} id |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 96 | Log ${deploymentId} |
Zack Williams | 821c502 | 2020-01-15 15:11:46 -0700 | [diff] [blame^] | 97 | ${test_result}= CORDRobot.ApiChameleonDelete CH_CORE_DEPLOYMENTS ${deploymentId} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 98 | Should Be True ${test_result} |