Commit 2408f4f1 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for PM individual jobs

parent 7e93bf70
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -116,3 +116,28 @@ PATCH Individual NFV-MANO Performance Job - Unprocessable content
    Send Patch request for individual NFV_MANO Performance Job with unprocessable content
    Check HTTP Response Status Code Is    422
    Check HTTP Response Body Json Schema Is     ProblemDetails

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

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

Send Patch request for individual NFV-MANO Performance Job with permitted authorization scope
    Log    Trying to perform a PATCH on PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${JOBS_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
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Patch request for individual NFV-MANO Performance Job with not permitted authorization scope
    Log    Trying to perform a PATCH on PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    Set Headers    {"Content-Type": "${CONTENT_TYPE_PATCH}"}
    ${scopeValue}=    Create Dictionary    scope=${JOBS_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}
    Check GET response from Notification Endpoint
    ${template}=    Get File    jsons/PmJobModifications.json
    ${body}=    Format String    ${template}    callbackUri=${callback_uri}
    PATCH    ${apiRoot}/${apiName}/${apiMajorVersion}/pm_jobs/${pmJobId}    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Patch request for individual NFV-MANO Performance Job - Etag mismatch
    Log    Trying to perform a PATCH on PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}