frontend config: flavor tests
Change-Id: I288f8d7c91385415193ed4e268aec72aa35e22e6
diff --git a/src/test/cord-api/Properties/RestApiProperties.py b/src/test/cord-api/Properties/RestApiProperties.py
index 1dbe83b..f1cd6ee 100644
--- a/src/test/cord-api/Properties/RestApiProperties.py
+++ b/src/test/cord-api/Properties/RestApiProperties.py
@@ -16,3 +16,4 @@
CORE_SLICES = '/api/core/slices/'
CORE_SANITY_NODES = '/api/core/nodes/?no_hyperlinks=1'
CORE_NODES = '/api/core/nodes/'
+CORE_FLAVORS = '/api/core/flavors/'
diff --git a/src/test/cord-api/Tests/SanityFlavors.txt b/src/test/cord-api/Tests/SanityFlavors.txt
new file mode 100644
index 0000000..4754cbb
--- /dev/null
+++ b/src/test/cord-api/Tests/SanityFlavors.txt
@@ -0,0 +1,74 @@
+*** Settings ***
+Documentation Test suite for Sanity Test of Flavors API
+Suite Setup Read InputFile
+Test Template Verify Flavor API functionality
+Library Collections
+Library String
+Library OperatingSystem
+Library XML
+Library RequestsLibrary
+Library ../Framework/utils/utils.py
+Library ../Framework/restApi.py
+
+*** Variables ***
+${USER} admin
+${PASSWORD} admin
+${PATHFILE} ${CURDIR}/data/SanityFlavors.json
+
+*** Test Cases *** TYPE LISTINDEX
+Test Add Flavor-1 CREATE 0
+
+Test Get Flavor-1 RETRIEVE 0
+
+Test Delete Flavor-1
+ DELETE 0
+
+Test Add Flavor-2 CREATE 1
+
+Test Get Flavor-2 RETRIEVE 1
+
+Test Delete Flavor-2
+ DELETE 1
+
+*** Keywords ***
+Read InputFile
+ ${flavorList} = utils.jsonToList ${PATHFILE} flavorsInfo
+ Set Suite Variable ${vList} ${flavorList}
+
+Verify Flavor API functionality
+ [Arguments] ${type} ${listIndex}
+ Run Keyword If "${type}" == "CREATE" Test Post Flavors ${listIndex}
+ Run Keyword If "${type}" == "RETRIEVE" Test Get Flavors ${listIndex}
+ Run Keyword If "${type}" == "DELETE" Test Delete Flavors ${listIndex}
+
+Test Post Flavors
+ [Arguments] ${listIndex}
+ ${flavorList} = Get Variable Value ${vList}
+ ${flavorDict}= utils.listToDict ${flavorList} ${listIndex}
+ ${api_result}= restApi.ApiPost CORE_FLAVORS ${flavorDict}
+ Should Be True ${api_result}
+
+Test Get Flavors
+ [Arguments] ${listIndex}
+ ${json_result}= restApi.ApiGet CORE_FLAVORS
+ Log ${json_result}
+ ${flavorList}= Get Variable Value ${vList}
+ ${inputDict}= utils.listToDict ${flavorList} ${listIndex}
+ ${flavorName}= utils.getFieldValueFromDict ${inputDict} name
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result} name ${flavorName}
+ ${test_result}= utils.compare_dict ${inputDict} ${getJsonDict}
+ Should Be True ${json_result}
+
+Test Delete Flavors
+ [Arguments] ${listIndex}
+ ${json_getresult}= restApi.ApiGet CORE_FLAVORS
+ ${flavorList}= Get Variable Value ${vList}
+ ${flavorDict}= utils.listToDict ${vList} ${listIndex}
+ ${flavorName}= utils.getFieldValueFromDict ${flavorDict} name
+ Log ${flavorName}
+ ${getFlavorDict}= utils.getDictFromListofDict ${json_getresult} name ${flavorName}
+ Log ${getFlavorDict}
+ ${flavorID}= utils.getFieldValueFromDict ${getFlavorDict} id
+ Log ${flavorID}
+ ${test_result}= restApi.ApiDelete CORE_FLAVORS ${flavorID}
+ Should be True ${test_result}
diff --git a/src/test/cord-api/Tests/SanityInstance.txt b/src/test/cord-api/Tests/SanityInstance.txt
index b149b57..f072f9c 100644
--- a/src/test/cord-api/Tests/SanityInstance.txt
+++ b/src/test/cord-api/Tests/SanityInstance.txt
@@ -36,8 +36,8 @@
*** Keywords ***
Read InputFile
- ${userList} = utils.jsonToList ${PATHFILE} InstanceInfo
- Set Suite Variable ${uList} ${userList}
+ ${instanceList} = utils.jsonToList ${PATHFILE} InstanceInfo
+ Set Suite Variable ${iList} ${instanceList}
Verify Instance API functionality
[Arguments] ${type} ${listIndex}
@@ -47,19 +47,19 @@
Test Post Instances
[Arguments] ${listIndex}
- ${userList} = Get Variable Value ${uList}
- ${userDict}= utils.listToDict ${userList} ${listIndex}
- ${api_result}= restApi.ApiPost CORE_SANITY_INSTANCES ${userDict}
+ ${instanceList} = Get Variable Value ${iList}
+ ${instanceDict}= utils.listToDict ${instanceList} ${listIndex}
+ ${api_result}= restApi.ApiPost CORE_SANITY_INSTANCES ${instanceDict}
Should Be True ${api_result}
Test Get Instances
[Arguments] ${listIndex}
- ${json_result}= restApi.ApiGet CORE_SANITY_INSTANCES
+ ${json_result}= restApi.ApiGet CORE_INSTANCES
Log ${json_result}
- ${userList}= Get Variable Value ${uList}
- ${inputDict}= utils.listToDict ${userList} ${listIndex}
- ${ID}= utils.getFieldValueFromDict ${inputDict} id
- ${getJsonDict}= utils.getDictFromListOfDict ${json_result} id ${ID}
+ ${instanceList}= Get Variable Value ${iList}
+ ${inputDict}= utils.listToDict ${instanceList} ${listIndex}
+ ${instanceName}= utils.getFieldValueFromDict ${inputDict} name
+ ${getJsonDict}= utils.getDictFromListOfDict ${json_result} name ${instanceName}
${test_result}= utils.compare_dict ${inputDict} ${getJsonDict}
Should Be True ${json_result}
@@ -68,10 +68,10 @@
${json_getresult}= restApi.ApiGet CORE_INSTANCES
${instanceList}= Get Variable Value ${iList}
${instanceDict}= utils.listToDict ${iList} ${listIndex}
- ${ID}= utils.getFieldValueFromDict ${instanceDict} id
- Log ${ID}
- ${getInstanceDict}= utils.getDictFromListofDict ${json_getresult} id ${ID}
- Log ${geInstanceDict}
+ ${instanceName}= utils.getFieldValueFromDict ${instanceDict} name
+ Log ${instanceName}
+ ${getInstanceDict}= utils.getDictFromListofDict ${json_getresult} name ${instanceName}
+ Log ${getInstanceDict}
${instanceID}= utils.getFieldValueFromDict ${getInstanceDict} id
Log ${instanceID}
${test_result}= restApi.ApiDelete CORE_INSTANCES ${instanceID}
diff --git a/src/test/cord-api/Tests/data/SanityFlavors.json b/src/test/cord-api/Tests/data/SanityFlavors.json
new file mode 100644
index 0000000..0437db2
--- /dev/null
+++ b/src/test/cord-api/Tests/data/SanityFlavors.json
@@ -0,0 +1,12 @@
+{
+ "flavorsInfo": [
+ {
+ "flavor": "mq.test",
+ "name": "mq.test"
+ },
+ {
+ "flavor": "mq.test2",
+ "name": "mq.test2"
+ }
+ ]
+}
diff --git a/src/test/cord-api/Tests/data/Sanity_Instance.json b/src/test/cord-api/Tests/data/Sanity_Instance.json
index 329a5cf..9886320 100644
--- a/src/test/cord-api/Tests/data/Sanity_Instance.json
+++ b/src/test/cord-api/Tests/data/Sanity_Instance.json
@@ -5,14 +5,16 @@
"image": 1,
"slice": 1,
"deployment": 1,
- "node": 1
+ "node": 1,
+ "creator" : 1
},
{
"name": "test-instance",
"image": 1,
"slice": 1,
"deployment": 1,
- "node": 1
+ "node": 1,
+ "creator" : 1
}
]
}