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

added oauth scope tests for change state op occ state task

parent 6d44ccb4
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -198,3 +198,28 @@ DELETE Change State Operation Occurrences - Method not implemented
    ...    Post-Conditions: none
    Send Delete request for Change State Operation Occurrences
    Check HTTP Response Status Code Is    405

GET Change State Operation Occurrences with permitted authorization scope
    [Documentation]    Test ID: 8.3.1.3.2
    ...    Test title: GET Change State Operation Occurrences with permitted authorization scope
    ...    Test objective: The objective is to query status information about multiple change state operation occurrences with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.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 Change State Operation Occurrences with permitted authorization scope
    Check HTTP Response Status Code Is    200
    Check HTTP Response Body Json Schema Is    ChangeStateOpOccs

GET Change State Operation Occurrences with not permitted authorization scope
    [Documentation]    Test ID: 8.3.1.3.2
    ...    Test title: GET Change State Operation Occurrences with not permitted authorization scope
    ...    Test objective: The objective is to query status information about multiple change state operation occurrences and verify the failure when using a not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.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 Change State Operation Occurrences with not permitted authorization scope
    Check HTTP Response Status Code Is    401
+24 −0
Original line number Diff line number Diff line
@@ -199,6 +199,30 @@ Get Change State Operation Occurrences
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}

Get Change State Operation Occurrences with permitted authorization scope
    Log    Query to GET information about multiple change state operation occurrences.
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    ${scopeValue}=    Create Dictionary    scope=${CHANGE_STATE_OPS_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}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/change_state_ops
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}

Get Change State Operation Occurrences with not permitted authorization scope
    Log    Query to GET information about multiple change state operation occurrences.
    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}
    Log    Execute Query and validate response
    Get    ${apiRoot}/${apiName}/${apiMajorVersion}/change_state_ops
    ${outputResponse}=    Output    response
	Set Global Variable    @{response}    ${outputResponse}
	
Get Change State Operation Occurrences with invalid filter
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"${AUTHORIZATION_HEADER}":"${AUTHORIZATION_TOKEN}"}
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ ${PEER_PERMITTED_SCOPE} nfvpolicy:v2:peer_entity_info
${PEER_NOT_PERMITTED_SCOPE}    nfvpolicy:v2:peer_entity_info:readonly
${SUBSCRIPTIONS_PERMITTED_SCOPE}    nfvpolicy:v2:subscriptions
${CHANGE_STATE_PERMITTED_SCOPE}    nfvpolicy:v2:change_state
${CHANGE_STATE_OPS_PERMITTED_SCOPE}    nfvpolicy:v2:change_state_ops
${NOT_PERMITTED_SCOPE}    nfvpolicy:v2:policies:invalid

${CONTENT_TYPE_JSON}    application/json