blob: b334c80d30cf043d038bcc5ef23e999f27bdbd68 [file] [log] [blame]
Suchitra Vemurif7410a92017-05-16 17:04:05 -07001*** Settings ***
2Documentation Test suite for Deployment verification
3Suite Setup Read InputFile
4Test Template Verify Deployment functionality
5Library Collections
6Library String
7Library OperatingSystem
8Library XML
9Library RequestsLibrary
Zack Williams821c5022020-01-15 15:11:46 -070010Library CORDRobot
11Library ImportResource resources=CORDRobot
Suchitra Vemurif7410a92017-05-16 17:04:05 -070012
13*** Variables ***
Suchitra Vemurif7410a92017-05-16 17:04:05 -070014${PATHFILE} ${CURDIR}/data/Ch_Deployment.json
15${PATHFILE2} ${CURDIR}/data/putDeployment.json
16
17*** Test Cases *** TYPE LISTINDEX
18Test Post Deployment-1
19 CREATE 0
20
21Test Get Deployment-1
22 RETRIEVE 0
23 #Test Edit Deployment-1 PUT 0
24
25Test Delete Deployment-1
26 DELETE 0
27
28Test Post Deployment-2
29 CREATE 1
30
31Test Get Deployment-2
32 RETRIEVE 1
33 #Test Edit Deployment-2 PUT 1
34
35Test Delete Deployment-2
36 DELETE 1
37
38*** Keywords ***
39Read InputFile
Zack Williams821c5022020-01-15 15:11:46 -070040 ${deploymentList}= CORDRobot.jsonToList ${PATHFILE} DeploymentInfo
Suchitra Vemurif7410a92017-05-16 17:04:05 -070041 Set Suite Variable ${dlist} ${deploymentList}
Zack Williams821c5022020-01-15 15:11:46 -070042 ${putDeploymentList}= CORDRobot.jsonToList ${PATHFILE2} DeploymentInfo
Suchitra Vemurif7410a92017-05-16 17:04:05 -070043 Set Suite Variable ${putList} ${putDeploymentList}
44
45Verify 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
52Test Post Deployment API
53 [Arguments] ${listIndex}
54 ${deploymentList} = Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -070055 ${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex}
56 ${api_result}= CORDRobot.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict}
Suchitra Vemurif7410a92017-05-16 17:04:05 -070057 Should Be True ${api_result}
58
59Test Get Deployment API
60 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -070061 ${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
Suchitra Vemurif7410a92017-05-16 17:04:05 -070062 ${json_result_list}= Get From Dictionary ${json_result} items
63 Log ${json_result_list}
64 ${deploymentList}= Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -070065 ${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 Vemurif7410a92017-05-16 17:04:05 -070069 Should Be True ${test_result}
70
71Test Edit Deployment API
72 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -070073 ${get_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
Suchitra Vemurif7410a92017-05-16 17:04:05 -070074 ${putDeploymentList}= Get Variable Value ${putList}
Zack Williams821c5022020-01-15 15:11:46 -070075 ${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 Vemurif7410a92017-05-16 17:04:05 -070080 Should Be True ${api_result}
Zack Williams821c5022020-01-15 15:11:46 -070081 ${getResultAfterPut}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS ${deploymentID}
82 ${test_result}= CORDRobot.compare_dict ${putDeploymentDict} ${getResultAfterPut}
Suchitra Vemurif7410a92017-05-16 17:04:05 -070083 Should Be True ${test_result}
84
85Test Delete Deployment API
86 [Arguments] ${listIndex}
Zack Williams821c5022020-01-15 15:11:46 -070087 ${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
Suchitra Vemurif7410a92017-05-16 17:04:05 -070088 ${json_result_list}= Get From Dictionary ${json_result} items
89 ${deploymentList}= Get Variable Value ${dlist}
Zack Williams821c5022020-01-15 15:11:46 -070090 ${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex}
91 ${name}= CORDRobot.getFieldValueFromDict ${deploymentDict} name
Suchitra Vemurif7410a92017-05-16 17:04:05 -070092 Log ${name}
Zack Williams821c5022020-01-15 15:11:46 -070093 ${deploymentDict}= CORDRobot.getDictFromListofDict ${json_result_list} name ${name}
Suchitra Vemurif7410a92017-05-16 17:04:05 -070094 Log ${deploymentDict}
Zack Williams821c5022020-01-15 15:11:46 -070095 ${deploymentId}= CORDRobot.getFieldValueFromDict ${deploymentDict} id
Suchitra Vemurif7410a92017-05-16 17:04:05 -070096 Log ${deploymentId}
Zack Williams821c5022020-01-15 15:11:46 -070097 ${test_result}= CORDRobot.ApiChameleonDelete CH_CORE_DEPLOYMENTS ${deploymentId}
Suchitra Vemurif7410a92017-05-16 17:04:05 -070098 Should Be True ${test_result}