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

added oauth scope tests for peer entities

parent 634e51c2
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -664,6 +664,32 @@ Send Post request for Peer Entity
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for Peer Entity with permitted authorization scope
    Log    Trying to perform a POST for Peer Entity
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PEER_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}
    ${template}=    Get File    jsons/CreatePeerEntityRequest.json
    ${body}=        Format String   ${template}     peerEntityId=${peerEntityId}    name=${name}    type=${type}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/peer_entities    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}

Send Post request for Peer Entity with not permitted authorization scope
    Log    Trying to perform a POST for Peer Entity
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
    ${scopeValue}=    Create Dictionary    scope=${PEER_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}
    ${template}=    Get File    jsons/CreatePeerEntityRequest.json
    ${body}=        Format String   ${template}     peerEntityId=${peerEntityId}    name=${name}    type=${type}
    POST    ${apiRoot}/${apiName}/${apiMajorVersion}/peer_entities    ${body}
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}
       
Get Peer Entities
    Log    Query to GET information about multiple peer entities.
    Set Headers  {"Accept":"${ACCEPT_JSON}"}  
+30 −0
Original line number Diff line number Diff line
@@ -237,3 +237,33 @@ DELETE Peer Entities - Method not implemented
    ...    Post-Conditions: none
    Send Delete request for Peer Entities
    Check HTTP Response Status Code Is    405

POST Peer Entity with permitted authorization scope
    [Documentation]    Test ID: 8.3.1.8.19
    ...    Test title: POST Peer Entity with permitted authorization scope
    ...    Test objective: The objective is to create in the producer NFV-MANO functional entity a new peer entity resource with permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.13.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Peer Entity is created
    Send Post request for Peer Entity with permitted authorization scope
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    PeerEntity
    Check HTTP Response Header Contains Location
    Check Postcondition Peer Entity Resource is created

POST Peer Entity with not permitted authorization scope
    [Documentation]    Test ID: 8.3.1.8.20
    ...    Test title: POST Peer Entity with not permitted authorization scope
    ...    Test objective: The objective is to test that creation in the producer NFV-MANO functional entity of a new peer entity resource fails with not permitted authorization scope.
    ...    Pre-conditions: none
    ...    Reference: clause 5.5.13.3.1 - ETSI GS NFV-SOL 009 [7] v4.5.1
    ...    Config ID: Config_prod_NFV-MANO
    ...    Applicability: none
    ...    Post-Conditions: Peer Entity is created
    Send Post request for Peer Entity with not permitted authorization scope
    Check HTTP Response Status Code Is    201
    Check HTTP Response Body Json Schema Is    PeerEntity
    Check HTTP Response Header Contains Location
    Check Postcondition Peer Entity Resource is created
 No newline at end of file