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

added oauth scope tests for NSFM subscriptions

parent 5c0434b4
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -322,6 +322,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}"}
+26 −1
Original line number Diff line number Diff line
@@ -299,6 +299,31 @@ Create a new alarm subscription - Unprocessable Content
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is  ProblemDetails

 Retrieve a list of alarm subscriptions with permitted authorization scope
    [Documentation]    Test ID: 5.3.3.3.23
    ...    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 8.4.4.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    FmSubscriptions

 Retrieve a list of alarm subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 5.3.3.3.4
    ...    Test title: Retrieve a list of alarm subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test that retrieve the list of active subscriptions fails when using not permitted authorization scope
    ...    Pre-conditions: none
    ...    Reference: Clause 8.4.4.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

*** Keywords ***
Void
    log    do nothing