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

added oauth scope tests for PM individual thresholds

parent a9bf5020
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -115,3 +115,28 @@ PATCH Individual Threshold - Unprocessable content
    Send Patch request for individual Performance Threshold with unprocessable content
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is    ProblemDetails

PATCH Individual Threshold with permitted authorization scope
    [Documentation]    Test ID: 8.3.2.5.10
    ...    Test title: PATCH Individual Threshold with permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method modify an existing NFV_MANO performance threshold with permitted authorization scope.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more performance thresholds are set.
    ...    Reference: clause 6.5.7.3.4 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Threshold resource is modified.
    Send Patch request for individual Performance Threshold with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ThresholdModifications

PATCH Individual Threshold with not permitted authorization scope
    [Documentation]    Test ID: 8.3.2.5.11
    ...    Test title: PATCH Individual Threshold with not permitted authorization scope
    ...    Test objective: The objective is to test that PATCH method fails with not permitted authorization scope.
    ...    Pre-conditions: A NFV-MANO instance is instantiated. One or more performance thresholds are set.
    ...    Reference: clause 6.5.7.3.4 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Threshold resource is modified.
    Send Patch request for individual Performance Threshold with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+36 −0
Original line number Diff line number Diff line
@@ -551,6 +551,42 @@ Send Patch request for individual Performance Threshold
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send Patch request for individual Performance Threshold with permitted authorization scope
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${THRESHOLD_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}
    Check GET response from Notification Endpoint
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds/${thresholdId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    ${template}=    Get File    jsons/ThresholdModification.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds/${thresholdId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send Patch request for individual Performance Threshold with not permitted authorization scope
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${THRESHOLD_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}
    Check GET response from Notification Endpoint
    GET    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds/${thresholdId}
    ${origOutput}=    Output    response
    Set Suite Variable    ${origResponse}    ${origOutput}
    ${template}=    Get File    jsons/ThresholdModification.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/thresholds/${thresholdId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    @{response}    ${output}

Send Patch request for individual Performance Threshold - Etag mismatch
    Log    Trying to PUT threshold
    Set Headers    {"Accept": "${ACCEPT_JSON}"}