aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/vnfsdk-refrepo/csar/valid_no_security.csarbin0 -> 18069 bytes
-rw-r--r--tests/vnfsdk-refrepo/csar_validation_tests.robot26
-rw-r--r--tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot15
3 files changed, 31 insertions, 10 deletions
diff --git a/tests/vnfsdk-refrepo/csar/valid_no_security.csar b/tests/vnfsdk-refrepo/csar/valid_no_security.csar
new file mode 100644
index 00000000..11d19453
--- /dev/null
+++ b/tests/vnfsdk-refrepo/csar/valid_no_security.csar
Binary files differ
diff --git a/tests/vnfsdk-refrepo/csar_validation_tests.robot b/tests/vnfsdk-refrepo/csar_validation_tests.robot
index 88075c6f..afe4301a 100644
--- a/tests/vnfsdk-refrepo/csar_validation_tests.robot
+++ b/tests/vnfsdk-refrepo/csar_validation_tests.robot
@@ -1,18 +1,24 @@
*** Settings ***
-Library OperatingSystem
-Library Process
-Library String
-Library Collections
-Library RequestsLibrary
-Library json
-
-
-*** Variables ***
-${base_url}= http://${REFREPO_IP}:8702/onapapi/vnfsdk-marketplace/v1
+Resource ./resources/vnfsdk_keywords.robot
*** Test Cases ***
+
Perform vnf refrepo healthcheck
[Documentation] Check if vnf refrepo is up and running
Create Session refrepo ${base_url}
${response}= Get Request refrepo /PackageResource/healthcheck
Should Be Equal As Strings ${response.status_code} 200
+
+Validate correct, no security CSAR
+ [Documentation] Valid CSAR with no security should PASS validation and should return no error
+ ${response}= Run curl -s --location --request POST '${base_url}/vtp/executions' --header 'Content-Type: multipart/form-data' --header 'Accept: application/json' --form 'file=@${csarpath}/${csar_valid_no_security}' --form 'executions=${execute_no_security_csar_validation}'
+ ${response}= String.Replace String ${response} \\n ${SPACE}
+ # Removing strings that are causing errors during evaluation,
+ # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes
+ ${response}= Remove String ${response} \\\\ \\u003c \\u003e \\"
+ ${json_response}= evaluate json.loads('''${response}''') json
+ Should Be Equal As Strings ${json_response[0]["results"]["criteria"]} PASS
+ FOR ${resault} IN @{json_response[0]["results"]["results"]}
+ Should Be Equal As Strings ${resault["errors"]} []
+ Should Be Equal As Strings ${resault["passed"]} True
+ END
diff --git a/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot b/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot
new file mode 100644
index 00000000..1bdcf71b
--- /dev/null
+++ b/tests/vnfsdk-refrepo/resources/vnfsdk_keywords.robot
@@ -0,0 +1,15 @@
+*** Settings ***
+Library OperatingSystem
+Library Process
+Library String
+Library Collections
+Library RequestsLibrary
+Library json
+
+*** Variables ***
+${base_url}= http://${REFREPO_IP}:8702/onapapi/vnfsdk-marketplace/v1
+
+${csarpath}= ${SCRIPTS}/../tests/vnfsdk-refrepo/csar
+
+${csar_valid_no_security}= valid_no_security.csar
+${execute_no_security_csar_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_valid_no_security}","pnf":"true"}}]