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

added oauth scope tests for NSLCM subscriptions

parent 29e3b538
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
@@ -1612,6 +1612,32 @@ GET Subscriptions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

GET Subscriptions with permitted authorization scope
    Log    Get the list of active subscriptions
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${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}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

GET Subscriptions with not permitted authorization scope
    Log    Get the list of active subscriptions
    Set Headers  {"Accept":"${ACCEPT}"}  
    Set Headers  {"Content-Type": "${CONTENT_TYPE}"}
    ${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}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${outputResponse}=    Output    response
	Set Global Variable    ${response}    ${outputResponse}

Get subscriptions with all_fields attribute selector
    Log    Get the list of active subscriptions, using fields
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
+25 −0
Original line number Diff line number Diff line
@@ -215,3 +215,28 @@ POST Create a new subscription - Unprocessable Content
    ...    Post-Conditions: none     
    POST subscriptions
    Check HTTP Response Status Code Is    422

GET Subscriptions with permitted authorization scope
    [Documentation]    Test ID: 5.3.2.15.17
    ...    Test title: GET Subscriptions with permitted authorization scope
    ...    Test objective: The objective is to test that GET method  retrieve the list of existing subscriptions with permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 6.4.16.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    GET Subscriptions with permitted authorization scope
    Check HTTP Response Status Code Is  200
    Check HTTP Response Body Json Schema Is    subscriptions

GET Subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 5.3.2.15.18
    ...    Test title: GET Subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test that GET method  retrieve the list of existing subscriptions fails when using not permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 6.4.16.3.2 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability: none
    ...    Post-Conditions: none    
    GET Subscriptions with not permitted authorization scope
    Check HTTP Response Status Code Is  401
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ ${HEAL_PERMITTED_SCOPE} nslcm:v2:heal
${TERMINATE_PERMITTED_SCOPE}    nslcm:v2:tearminate
${OPOCCS_PERMITTED_SCOPE}    nslcm:v2:op_occs
${OPOCCS_NOT_PERMITTED_SCOPE}    nslcm:v2:op_occs:readonly
${SUBSCRIPTIONS_NOT_PERMITTED_SCOPE}    nslcm:v2:subscriptions

${NOT_PERMITTED_SCOPE}    nslcm:v2:invalid