Commit 324935ce authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for subscriptions

parent 41662d6f
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -308,6 +308,28 @@ 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}"}
    ${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}
    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}"}
    ${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}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}
    
GET Subscriptions with filter
    Log    Get the list of active subscriptions using a filter
    Set Headers    {"Accept": "${ACCEPT}"}
+25 −0
Original line number Diff line number Diff line
@@ -230,3 +230,28 @@ POST Create a new Fault Management alarm subscription - Unprocessable content
    POST Subscription with Unreachable callbackUri
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is    ProblemDetails

Get list of alarm subscriptions with permitted authorization scope
    [Documentation]    Test ID: 8.3.3.3.18
    ...    Test title: Retrieve a list of alarm subscriptions with permitted authorization scope
    ...    Test objective: The objective is to retrieve the list of active subscriptions with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 7.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID:   Config_prod_NFV-MANO
    ...    Applicability:  none
    ...    Post-Conditions: noe
    GET Subscriptions with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    FmSubscriptions

Get list of alarm subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 8.3.3.3.19
    ...    Test title: Retrieve a list of alarm subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test that retrieving the list of active subscriptions fails with not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 7.5.5.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID:   Config_prod_NFV-MANO
    ...    Applicability:  none
    ...    Post-Conditions: noe
    GET Subscriptions with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@ ${BAD_AUTHORIZATION_TOKEN} Bear sometoken
${OAUTH_ENCRIPTION_ALGORITHM}    HS256
${ALAMRS_PERMITTED_SCOPE}    nfvmanofm:v2:alarm_info
${ALARMS_NOT_PERMITTED_SCOPE}    nfvmanofm:v2:alarm_info:readonly
${SUBSCRIPTIONS_PERMITTED_SCOPE}    nfvmanofm:v2:subscriptions
${SUBSCRIPTIONS_NOT_PERMITTED_SCOPE}    nfvmanofm:v2:subscriptions:readonly
${NOT_PERMITTED_SCOPE}    nfvmanofm:v2:policies:invalid