aboutsummaryrefslogtreecommitdiffstats
path: root/tests/vnfsdk-refrepo/csar_validation_tests.robot
blob: afe4301a18baf8d5a056e2f92cc5532381a42b1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*** Settings ***
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