blob: b334c80d30cf043d038bcc5ef23e999f27bdbd68 [file] [log] [blame]
*** Settings ***
Documentation Test suite for Deployment verification
Suite Setup Read InputFile
Test Template Verify Deployment functionality
Library Collections
Library String
Library OperatingSystem
Library XML
Library RequestsLibrary
Library CORDRobot
Library ImportResource resources=CORDRobot
*** Variables ***
${PATHFILE} ${CURDIR}/data/Ch_Deployment.json
${PATHFILE2} ${CURDIR}/data/putDeployment.json
*** Test Cases *** TYPE LISTINDEX
Test Post Deployment-1
CREATE 0
Test Get Deployment-1
RETRIEVE 0
#Test Edit Deployment-1 PUT 0
Test Delete Deployment-1
DELETE 0
Test Post Deployment-2
CREATE 1
Test Get Deployment-2
RETRIEVE 1
#Test Edit Deployment-2 PUT 1
Test Delete Deployment-2
DELETE 1
*** Keywords ***
Read InputFile
${deploymentList}= CORDRobot.jsonToList ${PATHFILE} DeploymentInfo
Set Suite Variable ${dlist} ${deploymentList}
${putDeploymentList}= CORDRobot.jsonToList ${PATHFILE2} DeploymentInfo
Set Suite Variable ${putList} ${putDeploymentList}
Verify Deployment functionality
[Arguments] ${type} ${listIndex}
Run Keyword If "${type}" == "CREATE" Test Post Deployment API ${listIndex}
Run Keyword If "${type}" == "RETRIEVE" Test Get Deployment API ${listIndex}
Run Keyword If "${type}" == "PUT" Test Edit Deployment API ${listIndex}
Run Keyword If "${type}" == "DELETE" Test Delete Deployment API ${listIndex}
Test Post Deployment API
[Arguments] ${listIndex}
${deploymentList} = Get Variable Value ${dlist}
${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex}
${api_result}= CORDRobot.ApiPost CH_CORE_DEPLOYMENTS ${deploymentDict}
Should Be True ${api_result}
Test Get Deployment API
[Arguments] ${listIndex}
${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
${json_result_list}= Get From Dictionary ${json_result} items
Log ${json_result_list}
${deploymentList}= Get Variable Value ${dlist}
${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex}
${name}= CORDRobot.getFieldValueFromDict ${deploymentDict} name
${getJsonDict}= CORDRobot.getDictFromListOfDict ${json_result_list} name ${name}
${test_result}= CORDRobot.compare_dict ${deploymentDict} ${getJsonDict}
Should Be True ${test_result}
Test Edit Deployment API
[Arguments] ${listIndex}
${get_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
${putDeploymentList}= Get Variable Value ${putList}
${putDeploymentDict}= CORDRobot.listToDict ${putDeploymentList} ${listIndex}
${name}= CORDRobot.getFieldValueFromDict ${putDeploymentDict} name
${deploymentDict}= CORDRobot.getDictFromListofDict ${get_result} name ${name}
${deploymentID}= CORDRobot.getFieldValueFromDict ${deploymentDict} id
${api_result}= CORDRobot.ApiPut CH_CORE_DEPLOYMENTS ${putDeploymentDict} ${deploymentID}
Should Be True ${api_result}
${getResultAfterPut}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS ${deploymentID}
${test_result}= CORDRobot.compare_dict ${putDeploymentDict} ${getResultAfterPut}
Should Be True ${test_result}
Test Delete Deployment API
[Arguments] ${listIndex}
${json_result}= CORDRobot.ApiGet CH_CORE_DEPLOYMENTS
${json_result_list}= Get From Dictionary ${json_result} items
${deploymentList}= Get Variable Value ${dlist}
${deploymentDict}= CORDRobot.listToDict ${deploymentList} ${listIndex}
${name}= CORDRobot.getFieldValueFromDict ${deploymentDict} name
Log ${name}
${deploymentDict}= CORDRobot.getDictFromListofDict ${json_result_list} name ${name}
Log ${deploymentDict}
${deploymentId}= CORDRobot.getFieldValueFromDict ${deploymentDict} id
Log ${deploymentId}
${test_result}= CORDRobot.ApiChameleonDelete CH_CORE_DEPLOYMENTS ${deploymentId}
Should Be True ${test_result}