blob: ab158eabc23c7a1be32042ab907bbd8d32ac4aad [file] [log] [blame]
Suchitra.Vemuri32e03c22016-11-03 11:57:53 -07001*** Settings ***
2Documentation Test suite for Utility Synchronizer API
3Suite Setup Read InputFile
4Test Template Verify Utility Synchronizer 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/UtilsSynchronizer.json
17
18*** Test Cases *** TYPE LISTINDEX
19Test Add Synchronizer-1
20 CREATE 0
21
22Test Get Synchronizer-1
23 RETRIEVE 0
24
25Test Delete Synchronizer-1
26 DELETE 0
27
28Test Add Synchronizer-2
29 CREATE 1
30
31Test Get Synchronizer-2
32 RETRIEVE 1
33
34Test Delete Synchronizer-2
35 DELETE 1
36
37Test Add Synchronizer-3
38 CREATE 2
39
40Test Get Synchronizer-3
41 RETRIEVE 2
42
43Test Delete Synchronizer-3
44 DELETE 2
45
46*** Keywords ***
47Read InputFile
48 ${syncList} = utils.jsonToList ${PATHFILE} SynchronizerInfo
49 Set Suite Variable ${sList} ${syncList}
50
51Verify Utility Synchronizer functionality
52 [Arguments] ${type} ${listIndex}
53 Run Keyword If "${type}" == "CREATE" Test Post Utils Synchronizer API ${listIndex}
54 Run Keyword If "${type}" == "RETRIEVE" Test Get Utils Synchronizer API ${listIndex}
55 Run Keyword If "${type}" == "DELETE" Test Delete Utils Synchronizer API ${listIndex}
56
57Test Post Utils Synchronizer API
58 [Arguments] ${listIndex}
59 ${syncList} = Get Variable Value ${sList}
60 ${syncDict}= utils.listToDict ${syncList} ${listIndex}
61 ${api_result}= restApi.ApiPost UTILS_SYNCHRONIZER ${syncDict}
62 Should Be True ${api_result}
63
64Test Get Utils Synchronizer API
65 [Arguments] ${listIndex}
66 ${json_result}= restApi.ApiGet UTILS_SYNCHRONIZER
67 Log ${json_result}
68 ${syncList}= Get Variable Value ${sList}
69 ${syncDict}= utils.listToDict ${syncList} ${listIndex}
70 ${syncName}= utils.getFieldValueFromDict ${syncDict} name
71 ${getJsonDict}= utils.getDictFromListOfDict ${json_result} name ${syncName}
72 ${test_result}= utils.compare_dict ${syncDict} ${getJsonDict}
73 Should Be True ${json_result}
74
75Test Delete Utils Synchronizer API
76 [Arguments] ${listIndex}
77 ${json_getresult}= restApi.ApiGet UTILS_SYNCHRONIZER
78 ${syncList}= Get Variable Value ${sList}
79 ${syncDict}= utils.listToDict ${syncList} ${listIndex}
80 ${syncName}= utils.getFieldValueFromDict ${syncDict} name
81 ${getSyncDict}= utils.getDictFromListofDict ${json_getresult} name ${syncName}
82 ${syncID}= utils.getFieldValueFromDict ${getSyncDict} id
83 ${test_result}= restApi.ApiDelete UTILS_SYNCHRONIZER ${syncID}
84 Should be True ${test_result}