Commit 1001e277 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for LogM individual subscriptions

parent 480ead27
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -89,3 +89,29 @@ PATCH Individual Subscription - Method not implemented
    ...    Post-Conditions: none
    Send Patch request for individual Threshold
    Check HTTP Response Status Code Is    405

GET Individual Subscription with permitted authorization scope
    [Documentation]    Test ID: 8.3.4.6.8
    ...    Test title: GET Individual  Subscription with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval of individual subscription with permitted authorization scope
    ...    Pre-conditions: At least one subscription is available in the NFV-MANO.
    ...    Reference: clause 8.5.8.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   LogmSubscription
    Check HTTP Response Body Subscription Identifier matches the requested Subscription

GET Individual Subscription with not permitted authorization scope
    [Documentation]    Test ID: 8.3.4.6.9
    ...    Test title: GET Individual  Subscription with not permitted authorization scope
    ...    Test objective: The objective is to test that the retrieval of individual subscription fails when using not permitted authorization scope
    ...    Pre-conditions: At least one subscription is available in the NFV-MANO.
    ...    Reference: clause 8.5.8.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
+20 −0
Original line number Diff line number Diff line
@@ -678,6 +678,26 @@ Get Individual Subscription
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Individual Subscription with permitted authorization scope
    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}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get Individual Subscription with not permitted authorization scope
    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}
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/subscriptions/${subscriptionId}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
    
Check HTTP Response Body Subscription Identifier matches the requested Subscription
    Log    Trying to check response ID
    Should Be Equal As Strings    ${response['body']['id']}    ${subscriptionId}