Grant.robot 5.82 KB
Newer Older
''[Documentation]   robot --outputdir ./outputs ./Grant.robot
...    Test Suite to validate Grant operations.
Elian Kraja's avatar
Elian Kraja committed

*** Settings ***
Resource    environment/variables.txt
Resource    ../../../GenericKeywords.robot
Elian Kraja's avatar
Elian Kraja committed
Library     REST    ${MEO_SCHEMA}://${MEO_HOST}:${MEO_PORT}    ssl_verify=false
Library     OperatingSystem


*** Test Cases ***
    [Documentation]   TP_MEC_MEC010p2_MEO_GRANT_001_OK
Elian Kraja's avatar
Elian Kraja committed
    ...  Check that MEO sends a synchronous grant response when a grant request is requested
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.1.3.1
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 (GrantRequest)
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 Note 2 (GrantRequest)
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1 (Grant)
Elian Kraja's avatar
Elian Kraja committed
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Create a GRANT request    grantRequest
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is   Grant

    [Documentation]   TP_MEC_MEC010p2_MEO_GRANT_001_BR
Elian Kraja's avatar
Elian Kraja committed
    ...  Check that MEO responds with an error when it receives a malformed request when a new grant request is performed
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.6.1.3.2
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1 (Grant)
Elian Kraja's avatar
Elian Kraja committed
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Create a GRANT request    grantBadRequest
Elian Kraja's avatar
Elian Kraja committed
    Check HTTP Response Status Code Is    400

    [Documentation]  TP_MEC_MEC010p2_MEO_GRANT_002_OK  
    ...  Check that MEO sends a synchronous grant response when a grant request is requested
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.1.3.1
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1        //GrantRequest
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1
Elian Kraja's avatar
Elian Kraja committed
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Create a GRANT request    grantRequest2
    Check HTTP Response Status Code Is    201
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is   Grant
    [Documentation]   TP_MEC_MEC010p2_MEO_GRANT_003_OK
    ...  Check that MEO sends an asynchronous grant response when a grant request is requested
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.1.3.1
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 (GrantRequest)
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 Note 2 (GrantRequest)
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1 (Grant)
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Create a GRANT request    grantRequestAsynchronous
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
Elian Kraja's avatar
Elian Kraja committed

    [Documentation]  TP_MEC_MEC010p2_MEO_GRANT_004_OK 
    ...  Check that MEO sends an asynchronous grant response when a grant request is requested
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.1.3.1
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 (GrantRequest)
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1 (Grant)
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Create a GRANT request    grantRequestAsynchronous2
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    
    [Documentation]    TP_MEC_MEC010p2_MEO_GRANT_005_OK
    ...  Check that MEO sends the status of a grant request when a query on a granting ID is performed.
    ...  The process of creating the grant is ongoing, no grant is available yet 
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.2.3.2
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1  
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Get an individual grant    ${GRANT_ID_ACCEPTED}
    Check HTTP Response Status Code Is    202
    Check HTTP Response Header Contains    Location
    
    [Documentation]    TP_MEC_MEC010p2_MEO_GRANT_006_OK
Elian Kraja's avatar
Elian Kraja committed
    ...  Check that MEO sends the status of a grant request when a query on a granting ID is performed.
    ...  The process of creating the grant is ongoing, no grant is available yet 
    ...  ETSI GS MEC 010-2 2.2.1, clause 7.5.2.3.2
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1  
Elian Kraja's avatar
Elian Kraja committed
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Get an individual grant    ${GRANT_ID}
    Check HTTP Response Status Code Is    200
Elian Kraja's avatar
Elian Kraja committed
    Check HTTP Response Header Contains    Location
    Check HTTP Response Body Json Schema Is   Grant
Elian Kraja's avatar
Elian Kraja committed
    
TC_MEC_MEC010p2_MEO_GRANT_006_NF
    [Documentation]    TP_MEC_MEC010p2_MEO_GRANT_006_NF
    ...  Check that MEO responds with an error when it receives 
    ...  a request for returning a grant referred with a wrong ID
    ...  ETSI GS MEC 010-2 2.1.1, clause 7.5.2.3.2
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
    Get an individual grant    ${NOT_EXISTING_GRANT_ID}
    Check HTTP Response Status Code Is    404
Elian Kraja's avatar
Elian Kraja committed
    
Elian Kraja's avatar
Elian Kraja committed

*** Keywords ***
Create a GRANT request
    [Arguments]    ${content}
    Set Headers    {"Accept":"application/json"}
    Set Headers    {"Content-Type":"application/json"}
    Set Headers    {"Authorization":"${TOKEN}"}
    ${file}=    Catenate    SEPARATOR=    jsons/    ${content}    .json
Elian Kraja's avatar
Elian Kraja committed
    ${body}=    Get File    ${file}
    Post    ${apiRoot}/${apiName}/${apiVersion}/grants    ${body}    allow_redirects=false
Elian Kraja's avatar
Elian Kraja committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}


Get an individual grant
    [Arguments]    ${grantId}
    Set Headers    {"Accept":"application/json"}
Elian Kraja's avatar
Elian Kraja committed
    Set Headers    {"Authorization":"${TOKEN}"}
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}    allow_redirects=false
Elian Kraja's avatar
Elian Kraja committed
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}