blob: 5c38bd7a34307edc105f0daf4d41c17e4d147ee1 [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
10Library ../Framework/utils/utils.py
11Library ../Framework/restApi.py
12
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
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
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}
55 ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex}
56 ${api_result}= restApi.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict}
57 Should Be True ${api_result}
58
59Test 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
71Test 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
85Test 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}