Commit d756dcb7 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for VNF Pkg subscriptions

parent 16939ac1
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -171,3 +171,28 @@ Get VNF Package Subscriptions - Bad Request Response too Big
    Get all VNF Package Subscriptions
    Check HTTP Response Status Code Is    400
    Check HTTP Response Body Json Schema Is   ProblemDetails   

Get All VNF Package Subscriptions with permitted authorization scope
    [Documentation]    Test ID: 5.3.5.7.13
    ...    Test title: GET all VNF Package Subscriptions with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of all VNF package subscriptions with permitted authorization scope
    ...    Pre-conditions: At least one VNF package subscription is available in the NFVO.
    ...    Reference: Clause 9.4.8.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all VNF Package Subscriptions with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    PkgmSubscriptions

Get All VNF Package Subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 5.3.5.7.14
    ...    Test title: GET all VNF Package Subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of all VNF package subscriptions fails when using not permitted authorization scope
    ...    Pre-conditions: At least one VNF package subscription is available in the NFVO.
    ...    Reference: Clause 9.4.8.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all VNF Package Subscriptions with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+22 −0
Original line number Diff line number Diff line
@@ -952,6 +952,28 @@ Get all VNF Package Subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all VNF Package Subscriptions with permitted authorization scope
    Log    Trying to get the list of subscriptions
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${SUBSCRIPTIONS_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all VNF Package Subscriptions with not permitted authorization scope
    Log    Trying to get the list of subscriptions
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${NOT_PERMITTED_SCOPE} 
    ${authorizationToken}=    JWT Encode    payload=${scopeValue}    key=''    algorithm=${OAUTH_ENCRIPTION_ALGORITHM}
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${authorizationToken}"}
    Log    Authorization Token: ${authorizationToken}
    REST.GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get VNF Package Subscriptions with attribute-based filters
    Log    Trying to get the list of subscriptions using filters
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+3 −2
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ ${CONTENT_PERMITTED_SCOPE} vnfpkgm:v2:vnf_package_content
${CONTENT_NOT_PERMITTED_SCOPE}    vnfpkgm:v2:vnf_package_content:readonly
${BULK_PERMITTED_SCOPE}    vnfpkgm:v2:bulk_artifacts:readonly
${ARTIFACT_PERMITTED_SCOPE}    vnfpkgm:v2:artifact:readonly
${URI_PERMITTED_SCOPE}    vnfpkgm:v2:artifact::upload_from_uri
${URI_PERMITTED_SCOPE}    vnfpkgm:v2:upload_from_uri
${SUBSCRIPTIONS_PERMITTED_SCOPE}    vnfpkgm:v2:subscriptions
${NOT_PERMITTED_SCOPE}    vnfpkgm:v2:invalid