Commit 54d5658b authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for individual subscriptions

parent 324935ce
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -386,6 +386,28 @@ GET Individual Subscription
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}  

GET Individual Subscription with permitted authorization scope
    log    Trying to get information about an individual subscription
    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/${subscriptionId}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse}  

GET Individual Subscription with not permitted authorization scope
    log    Trying to get information about an individual subscription
    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/${subscriptionId}
    ${outputResponse}=    Output    response
    Set Global Variable    @{response}    ${outputResponse} 
    
PUT Individual Subscription
    log    Trying to perform a PUT. This method should not be implemented
    Set Headers  {"Accept":"${ACCEPT}"}
+26 −1
Original line number Diff line number Diff line
@@ -75,3 +75,28 @@ DELETE an individual subscription
    DELETE Individual Subscription
    Check HTTP Response Status Code Is    204
    Check Individual Subscription deleted

Get Information about an individual subscription with permitted authorization scope
    [Documentation]    Test ID: 8.3.3.4.7
    ...    Test title: Get Information about an individual subscription with permitted authorization scope
    ...    Test objective: The objective is to read an individual subscription from NFV-MANO alarms subscribed by the client with permitted authorization scope
    ...    Pre-conditions: The subscription with the given id exists
    ...   Reference: clause 7.5.6.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability:   none
    ...    Post-Conditions:  none
    GET Individual Subscription with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    FmSubscription

Get Information about an individual subscription with not permitted authorization scope
    [Documentation]    Test ID: 8.3.3.4.7
    ...    Test title: Get Information about an individual subscription with not permitted authorization scope
    ...    Test objective: The objective is to test that reading an individual subscription from NFV-MANO alarms subscribed by the client fails with not permitted authorization scope
    ...    Pre-conditions: The subscription with the given id exists
    ...   Reference: clause 7.5.6.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability:   none
    ...    Post-Conditions:  none
    GET Individual Subscription with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ ${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