blob: 7a3de5dc37e37e587575d57b88c95c3c18559c0e [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 ***
14${USER} admin
15${PASSWORD} admin
16${PATHFILE} ${CURDIR}/data/Ch_Deployment.json
17${PATHFILE2} ${CURDIR}/data/putDeployment.json
18
19*** Test Cases *** TYPE LISTINDEX
20Test Post Deployment-1
21 CREATE 0
22
23Test Get Deployment-1
24 RETRIEVE 0
25 #Test Edit Deployment-1 PUT 0
26
27Test Delete Deployment-1
28 DELETE 0
29
30Test Post Deployment-2
31 CREATE 1
32
33Test Get Deployment-2
34 RETRIEVE 1
35 #Test Edit Deployment-2 PUT 1
36
37Test Delete Deployment-2
38 DELETE 1
39
40*** Keywords ***
41Read InputFile
42 ${deploymentList}= utils.jsonToList ${PATHFILE} DeploymentInfo
43 Set Suite Variable ${dlist} ${deploymentList}
44 ${putDeploymentList}= utils.jsonToList ${PATHFILE2} DeploymentInfo
45 Set Suite Variable ${putList} ${putDeploymentList}
46
47Verify Deployment functionality
48 [Arguments] ${type} ${listIndex}
49 Run Keyword If "${type}" == "CREATE" Test Post Deployment API ${listIndex}
50 Run Keyword If "${type}" == "RETRIEVE" Test Get Deployment API ${listIndex}
51 Run Keyword If "${type}" == "PUT" Test Edit Deployment API ${listIndex}
52 Run Keyword If "${type}" == "DELETE" Test Delete Deployment API ${listIndex}
53
54Test Post Deployment API
55 [Arguments] ${listIndex}
56 ${deploymentList} = Get Variable Value ${dlist}
57 ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex}
58 ${api_result}= restApi.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict}
59 Should Be True ${api_result}
60
61Test Get Deployment API
62 [Arguments] ${listIndex}
63 ${json_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS
64 ${json_result_list}= Get From Dictionary ${json_result} items
65 Log ${json_result_list}
66 ${deploymentList}= Get Variable Value ${dlist}
67 ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex}
68 ${name}= utils.getFieldValueFromDict ${deploymentDict} name
69 ${getJsonDict}= utils.getDictFromListOfDict ${json_result_list} name ${name}
70 ${test_result}= utils.compare_dict ${deploymentDict} ${getJsonDict}
71 Should Be True ${test_result}
72
73Test Edit Deployment API
74 [Arguments] ${listIndex}
75 ${get_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS
76 ${putDeploymentList}= Get Variable Value ${putList}
77 ${putDeploymentDict}= utils.listToDict ${putDeploymentList} ${listIndex}
78 ${name}= utils.getFieldValueFromDict ${putDeploymentDict} name
79 ${deploymentDict}= utils.getDictFromListofDict ${get_result} name ${name}
80 ${deploymentID}= utils.getFieldValueFromDict ${deploymentDict} id
81 ${api_result}= restApi.ApiPut CH_CORE_DEPLOYMENTS ${putDeploymentDict} ${deploymentID}
82 Should Be True ${api_result}
83 ${getResultAfterPut}= restApi.ApiGet CH_CORE_DEPLOYMENTS ${deploymentID}
84 ${test_result}= utils.compare_dict ${putDeploymentDict} ${getResultAfterPut}
85 Should Be True ${test_result}
86
87Test Delete Deployment API
88 [Arguments] ${listIndex}
89 ${json_result}= restApi.ApiGet CH_CORE_DEPLOYMENTS
90 ${json_result_list}= Get From Dictionary ${json_result} items
91 ${deploymentList}= Get Variable Value ${dlist}
92 ${deploymentDict}= utils.listToDict ${deploymentList} ${listIndex}
93 ${name}= utils.getFieldValueFromDict ${deploymentDict} name
94 Log ${name}
95 ${deploymentDict}= utils.getDictFromListofDict ${json_result_list} name ${name}
96 Log ${deploymentDict}
97 ${deploymentId}= utils.getFieldValueFromDict ${deploymentDict} id
98 Log ${deploymentId}
99 ${test_result}= restApi.ApiChameleonDelete CH_CORE_DEPLOYMENTS ${deploymentId}
100 Should Be True ${test_result}