Add test for csar validation in vnfsdk refrepo.
[integration/csit.git] / tests / vnfsdk-refrepo / csar_validation_tests.robot
1 *** Settings ***
2 Resource          ./resources/vnfsdk_keywords.robot
3
4 *** Test Cases ***
5
6 Perform vnf refrepo healthcheck
7     [Documentation]    Check if vnf refrepo is up and running
8     Create Session   refrepo  ${base_url}
9     ${response}=    Get Request    refrepo   /PackageResource/healthcheck
10     Should Be Equal As Strings  ${response.status_code}     200
11
12 Validate correct, no security CSAR
13     [Documentation]    Valid CSAR with no security should PASS validation and should return no error
14     ${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}'
15     ${response}=    String.Replace String    ${response}    \\n   ${SPACE}
16     # Removing strings that are causing errors during evaluation,
17     # those strings are dependent on validation response and may need to be changed if vnf refrepo response changes
18     ${response}=   Remove String    ${response}    \\\\    \\u003c    \\u003e   \\"
19     ${json_response}=    evaluate    json.loads('''${response}''')    json
20     Should Be Equal As Strings    ${json_response[0]["results"]["criteria"]}   PASS
21     FOR   ${resault}  IN  @{json_response[0]["results"]["results"]}
22         Should Be Equal As Strings   ${resault["errors"]}   []
23         Should Be Equal As Strings   ${resault["passed"]}   True
24     END