Commit 5c0434b4 authored by Giacomo Bernini's avatar Giacomo Bernini Committed by Giacomo Bernini
Browse files

added oauth scope tests for NSFM individual alarms

parent 75f39646
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -122,3 +122,26 @@ DELETE Individual Alarm - Method not implemented
    ...    Post-Conditions: none
    DELETE Individual Alarm
    Check HTTP Response Status Code Is    405

PATCH Alarm with permitted authorization scope
    [Documentation]    Test ID: 5.3.3.2.9
    ...    Test title: Modify an individual alarm resource with permitted authorization scope
    ...    Test objective: The objective is to Modify an individual alarm resource with permitted authorization scope
    ...    Reference: Clause 8.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability:  none
    ...    Post-Conditions:  none
    PATCH Individual Alarm with permitted authorization scope
    Check HTTP Response Status Code Is    200  
    Check HTTP Response Body Json Schema Is    alarmModifications

PATCH Alarm with not permitted authorization scope
    [Documentation]    Test ID: 5.3.3.2.10
    ...    Test title: Modify an individual alarm resource with not permitted authorization scope
    ...    Test objective: The objective is to test that Modify an individual alarm resource fails when using not permitted authorization scope
    ...    Reference: Clause 8.4.3.3.4 - ETSI GS NFV-SOL 005 [3] v4.5.1
    ...    Config ID: Config_prod_NFVO
    ...    Applicability:  none
    ...    Post-Conditions:  none
    PATCH Individual Alarm with not permitted authorization scope
    Check HTTP Response Status Code Is    401
 No newline at end of file
+27 −1
Original line number Diff line number Diff line
@@ -223,6 +223,32 @@ PATCH Individual Alarm
    ${outputResponse}=    Output    response
    Set Global Variable    ${response}    ${outputResponse}

PATCH Individual Alarm with permitted authorization scope
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    ${scopeValue}=    Create Dictionary    scope=${ALARMS_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}
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    ${response}    ${outputResponse}

PATCH Individual Alarm with not permitted authorization scope
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"} 
    Set Headers  {"Content-Type": "${CONTENT_TYPE_PATCH}"} 
    ${scopeValue}=    Create Dictionary    scope=${ALARMS_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}
    ${body}=    Get File    jsons/alarmModifications.json
    Patch    ${apiRoot}/${apiName}/${apiMajorVersion}/alarms/${alarmId}    ${body}
    ${outputResponse}=    Output    response
    Set Global Variable    ${response}    ${outputResponse}

PATCH Individual Alarm - ETag mismatch
    log    Trying to perform a PATCH. This method modifies an individual alarm resource
    Set Headers  {"Accept":"${ACCEPT}"}