Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for Sanity Test of Slice API |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify Slice API 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/Sanity_slice.json |
| 17 | |
| 18 | *** Test Cases *** TYPE LISTINDEX |
| 19 | Test Add Slice-1 CREATE 0 |
| 20 | |
| 21 | Test Get Slice-1 RETRIEVE 0 |
| 22 | |
Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 23 | *** Keywords *** |
| 24 | Read InputFile |
| 25 | ${sliceList} = utils.jsonToList ${PATHFILE} sliceInfo |
| 26 | Set Suite Variable ${sList} ${sliceList} |
| 27 | |
| 28 | Verify Slice API functionality |
| 29 | [Arguments] ${type} ${listIndex} |
You Wang | 123d694 | 2017-03-01 12:33:02 -0800 | [diff] [blame] | 30 | Run Keyword If "${type}" == "CREATE" Test Post Slices ${listIndex} |
| 31 | Run Keyword If "${type}" == "RETRIEVE" Test Get Slices ${listIndex} |
| 32 | Run Keyword If "${type}" == "DELETE" Test Delete Slices ${listIndex} |
Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 33 | |
You Wang | 123d694 | 2017-03-01 12:33:02 -0800 | [diff] [blame] | 34 | Test Post Slices |
Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 35 | [Arguments] ${listIndex} |
| 36 | ${sliceList} = Get Variable Value ${sList} |
| 37 | ${sliceDict}= utils.listToDict ${sliceList} ${listIndex} |
| 38 | ${api_result}= restApi.ApiPost CORE_SANITY_SLICES ${sliceDict} |
| 39 | Should Be True ${api_result} |
| 40 | |
You Wang | 123d694 | 2017-03-01 12:33:02 -0800 | [diff] [blame] | 41 | Test Get Slices |
Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 42 | [Arguments] ${listIndex} |
| 43 | ${json_result}= restApi.ApiGet CORE_SLICES |
| 44 | Log ${json_result} |
| 45 | ${sliceList}= Get Variable Value ${sList} |
| 46 | ${inputDict}= utils.listToDict ${sliceList} ${listIndex} |
| 47 | ${ID}= utils.getFieldValueFromDict ${inputDict} id |
| 48 | ${getJsonDict}= utils.getDictFromListOfDict ${json_result} id ${ID} |
| 49 | ${test_result}= utils.compare_dict ${inputDict} ${getJsonDict} |
| 50 | Should Be True ${json_result} |
| 51 | |
You Wang | 123d694 | 2017-03-01 12:33:02 -0800 | [diff] [blame] | 52 | Test Delete Slices |
Suchitra.Vemuri | 75dffd4 | 2016-12-20 15:35:25 -0800 | [diff] [blame] | 53 | [Arguments] ${listIndex} |
| 54 | ${json_getresult}= restApi.ApiGet CORE_SLICES |
| 55 | ${sliceList}= Get Variable Value ${sList} |
| 56 | ${sliceDict}= utils.listToDict ${sList} ${listIndex} |
| 57 | ${sliceName}= utils.getFieldValueFromDict ${sliceDict} name |
| 58 | Log ${sliceName} |
| 59 | ${getSliceDict}= utils.getDictFromListofDict ${json_getresult} name ${sliceName} |
| 60 | Log ${getSliceDict} |
| 61 | ${sliceID}= utils.getFieldValueFromDict ${getSliceDict} id |
| 62 | Log ${sliceID} |
| 63 | ${test_result}= restApi.ApiDelete CORE_SLICES ${sliceID} |
| 64 | Should be True ${test_result} |