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

updated oauth scope tests for subscriptions

parent 05df9c20
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -670,6 +670,30 @@ Get all Subscriptions
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all Subscriptions with permitted authorization scope
    [Documentation]    The api consumer can use this method to query the list of active subscriptions to log management notifications
    Set headers    {"Accept": "application/json"}
    Set headers    {"Content-Type": "application/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
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Get all Subscriptions with not permitted authorization scope
    [Documentation]    The api consumer can use this method to query the list of active subscriptions to log management notifications
    Set headers    {"Accept": "application/json"}
    Set headers    {"Content-Type": "application/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
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

 Get Subscriptions with attribute-based filters
    [Documentation]    The api consumer can use this method to query the list of active subscriptions to log management notifications
    Set headers    {"Accept": "${ACCEPT_JSON}"}
+25 −0
Original line number Diff line number Diff line
@@ -185,3 +185,28 @@ POST Create a new subscription - Unprocessable Content
    Send Post Request for Subscription with Unreachable callbackUri
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is  ProblemDetails

GET all Subscriptions with permitted authorization scope
    [Documentation]    Test ID: 8.3.1.10.14
    ...    Test title: GET all Subscriptions with permitted authorization scope
    ...    Test objective: The objective is to test the retrieval list of active subscriptions of API consumer when a permitted authorization scope is used.
    ...    Pre-conditions:  At least one subscription is available in the NFV-MANO.
    ...    Reference: clause 5.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all Subscriptions with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    CimSubscriptions

GET all Subscriptions with not permitted authorization scope
    [Documentation]    Test ID: 8.3.1.10.15
    ...    Test title: GET all Subscriptions with not permitted authorization scope
    ...    Test objective: The objective is to test the retrieval list of active subscriptions of API consumer ffails when a not permitted authorization scope is used.
    ...    Pre-conditions:  At least one subscription is available in the NFV-MANO.
    ...    Reference: clause 5.5.4.3.2 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: none    
    Get all Subscriptions with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ ${ENTITY_PERMITTED_SCOPE} nfvpolicy:v2:mano_entity_info
${ENTITY_NOT_PERMITTED_SCOPE}    nfvpolicy:v2:mano_entity_info:readonly
${PEER_PERMITTED_SCOPE}    nfvpolicy:v2:peer_entity_info
${PEER_NOT_PERMITTED_SCOPE}    nfvpolicy:v2:peer_entity_info:readonly
${SUBSCRIPTIONS_PERMITTED_SCOPE}    nfvpolicy:v2:subscriptions
${NOT_PERMITTED_SCOPE}    nfvpolicy:v2:policies:invalid

${CONTENT_TYPE_JSON}    application/json