Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test suite for volt Tenant Verification - Chameleon API |
| 3 | Suite Setup Read InputFile |
| 4 | Test Template Verify volt Tenant 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/Ch_VoltTenant.json |
| 17 | ${PATHFILE2} ${CURDIR}/data/Ch_putVoltTenant.json |
| 18 | |
| 19 | *** Test Cases *** TYPE LISTINDEX |
| 20 | Test volt Tenant-1 CREATE 0 |
| 21 | |
| 22 | Test volt Tenant-2 CREATE 1 |
| 23 | |
| 24 | Test volt Tenant-3 CREATE 2 |
| 25 | |
| 26 | *** Keywords *** |
| 27 | Read InputFile |
| 28 | ${voltList} = utils.jsonToList ${PATHFILE} voltSubscriberInfo |
| 29 | Set Suite Variable ${vlist} ${voltList} |
| 30 | ${putvoltList}= utils.jsonToList ${PATHFILE2} voltSubscriberInfo |
| 31 | Set Suite Variable ${putList} ${putvoltList} |
| 32 | |
| 33 | Verify volt Tenant Functionality |
| 34 | [Arguments] ${type} ${listIndex} |
| 35 | Run Keyword If "${type}" == "CREATE" Test Post volt Tenant API ${listIndex} |
| 36 | |
| 37 | Test Post volt Tenant API |
| 38 | [Arguments] ${listIndex} |
| 39 | ${voltTenantList} = Get Variable Value ${vlist} |
| 40 | ${voltTenantDict}= utils.listToDict ${voltTenantList} ${listIndex} |
| 41 | ${voltDict}= Get From Dictionary ${voltTenantDict} voltTenant |
| 42 | ${service_specific_id}= Get From Dictionary ${voltTenantDict} service_specific_id |
| 43 | ${get_result}= restApi.ApiGet VOLT_SUBSCRIBER |
| 44 | ${get_result_list}= Get From Dictionary ${get_result} items |
| 45 | ${subscriberDict}= utils.getDictFromListofDict ${get_result_list} service_specific_id ${service_specific_id} |
| 46 | ${subscriberID}= utils.getFieldValueFromDict ${subscriberDict} id |
| 47 | Log ${subscriberID} |
| 48 | ${updatedVoltDict}= utils.setFieldValueInDict ${voltDict} subscriber_root_id ${subscriberID} |
| 49 | ${api_result}= restApi.ApiPost VOLT_TENANT ${updatedVoltDict} |
| 50 | Should Be True ${api_result} |
| 51 | # Verifying Get operation after POST |
| 52 | ${getVolt_result}= restApi.ApiGet VOLT_TENANT |
| 53 | ${getVolt_result_list}= Get From Dictionary ${getVolt_result} items |
| 54 | ${getJsonDict}= utils.getDictFromListOfDict ${getVolt_result_list} subscriber_root_id ${subscriberID} |
| 55 | ${test_result}= utils.compare_dict ${voltDict} ${getJsonDict} |
| 56 | Should Be True ${test_result} |
| 57 | # Verifying PUT operation |
| 58 | ${putvoltList}= Get Variable Value ${putList} |
| 59 | ${putVoltDict}= utils.listToDict ${putvoltList} ${listIndex} |
| 60 | ${putvoltTenantDict}= Get From Dictionary ${putVoltDict} voltTenant |
| 61 | ${voltID}= utils.getFieldValueFromDict ${getJsonDict} id |
| 62 | ${put_result}= restApi.ApiChameleonPut VOLT_TENANT ${putvoltTenantDict} ${voltID} |
| 63 | Should Be True ${put_result} |
| 64 | # Verifying Get after PUT operation |
| 65 | #${getVolt_afterPut}= restApi.ApiGet VOLT_TENANT |
| 66 | #${getVoltDict}= utils.getDictFromListofDict ${getVolt_afterPut} id ${voltID} |
Suchitra Vemuri | 9acc883 | 2017-05-30 15:39:39 -0700 | [diff] [blame^] | 67 | ${getVoltDict}= restApi.ApiChameleonGet VOLT_TENANT ${voltID} |
Suchitra Vemuri | f7410a9 | 2017-05-16 17:04:05 -0700 | [diff] [blame] | 68 | ${result_afterPut}= utils.compare_dict ${putvoltTenantDict} ${getVoltDict} |
| 69 | Should Be True ${result_afterPut} |