Suchitra.Vemuri | 32e03c2 | 2016-11-03 11:57:53 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for Utility Synchronizer API |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify Utility Synchronizer functionality |
| 5 | Library Collections |
| 6 | Library String |
| 7 | Library OperatingSystem |
| 8 | Library XML |
| 9 | Library RequestsLibrary |
| 10 | Library ../Framework/utils/utils.py |
| 11 | Library ../Framework/restApi.py |
| 12 | |
| 13 | *** Variables *** |
| 14 | ${USER} admin |
| 15 | ${PASSWORD} admin |
| 16 | ${PATHFILE} ${CURDIR}/data/UtilsSynchronizer.json |
| 17 | |
| 18 | *** Test Cases *** TYPE LISTINDEX |
| 19 | Test Add Synchronizer-1 |
| 20 | CREATE 0 |
| 21 | |
| 22 | Test Get Synchronizer-1 |
| 23 | RETRIEVE 0 |
| 24 | |
| 25 | Test Delete Synchronizer-1 |
| 26 | DELETE 0 |
| 27 | |
| 28 | Test Add Synchronizer-2 |
| 29 | CREATE 1 |
| 30 | |
| 31 | Test Get Synchronizer-2 |
| 32 | RETRIEVE 1 |
| 33 | |
| 34 | Test Delete Synchronizer-2 |
| 35 | DELETE 1 |
| 36 | |
| 37 | Test Add Synchronizer-3 |
| 38 | CREATE 2 |
| 39 | |
| 40 | Test Get Synchronizer-3 |
| 41 | RETRIEVE 2 |
| 42 | |
| 43 | Test Delete Synchronizer-3 |
| 44 | DELETE 2 |
| 45 | |
| 46 | *** Keywords *** |
| 47 | Read InputFile |
| 48 | ${syncList} = utils.jsonToList ${PATHFILE} SynchronizerInfo |
| 49 | Set Suite Variable ${sList} ${syncList} |
| 50 | |
| 51 | Verify 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 | |
| 57 | Test 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 | |
| 64 | Test 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 | |
| 75 | Test 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} |