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

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


*** Test Cases ***
12
TC_MEC_MEC010p2_MEO_GRANT_001_OK
piscione's avatar
piscione committed
13
    [Documentation]   TP_MEC_MEC010p2_MEO_GRANT_001_OK
Elian Kraja's avatar
Elian Kraja committed
14
    ...  Check that MEO sends a synchronous grant response when a grant request is requested
15
16
    ...  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)
piscione's avatar
piscione committed
17
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.2.2-1 Note 2 (GrantRequest)
18
    ...  ETSI GS MEC 010-2 2.2.1, Table 6.2.4.4.2-1 (Grant)
Elian Kraja's avatar
Elian Kraja committed
19
20
21
22
23
24
    [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

25
TC_MEC_MEC010p2_MEO_GRANT_001_BR
piscione's avatar
piscione committed
26
    [Documentation]   TP_MEC_MEC010p2_MEO_GRANT_001_BR
Elian Kraja's avatar
Elian Kraja committed
27
    ...  Check that MEO responds with an error when it receives a malformed request when a new grant request is performed
28
29
    ...  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
30
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
piscione's avatar
piscione committed
31
    Create a GRANT request    grantBadRequest
Elian Kraja's avatar
Elian Kraja committed
32
33
    Check HTTP Response Status Code Is    400

34
TC_MEC_MEC010p2_MEO_GRANT_002_OK
piscione's avatar
piscione committed
35
36
37
38
39
    [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
40
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
41
42
    Create a GRANT request    grantRequest2
    Check HTTP Response Status Code Is    201
43
    Check HTTP Response Header Contains    Location
44
    Check HTTP Response Body Json Schema Is   Grant
piscione's avatar
piscione committed
45
    
46
47


48
TC_MEC_MEC010p2_MEO_GRANT_003_OK
piscione's avatar
piscione committed
49
50
51
52
53
54
55
56
57
58
    [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
59

piscione's avatar
piscione committed
60

61
62

TC_MEC_MEC010p2_MEO_GRANT_004_OK
piscione's avatar
piscione committed
63
64
65
66
67
68
69
70
71
72
    [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
    
73

74
TC_MEC_MEC010p2_MEO_GRANT_005_OK
piscione's avatar
piscione committed
75
76
77
78
79
80
81
82
83
84
    [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
    
85
TC_MEC_MEC010p2_MEO_GRANT_006_OK
piscione's avatar
piscione committed
86
    [Documentation]    TP_MEC_MEC010p2_MEO_GRANT_006_OK
Elian Kraja's avatar
Elian Kraja committed
87
88
    ...  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 
piscione's avatar
piscione committed
89
90
    ...  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
91
    [Tags]    PIC_GRANTS_MANAGEMENT    INCLUDE_UNDEFINED_SCHEMAS
92
93
    Get an individual grant    ${GRANT_ID}
    Check HTTP Response Status Code Is    200
Elian Kraja's avatar
Elian Kraja committed
94
    Check HTTP Response Header Contains    Location
95
    Check HTTP Response Body Json Schema Is   Grant
Elian Kraja's avatar
Elian Kraja committed
96
    
97
98
99
100
101
102
103
104
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
105
    
piscione's avatar
piscione committed
106
   
Elian Kraja's avatar
Elian Kraja committed
107
108
109
110
111
112
113

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


Get an individual grant
    [Arguments]    ${grantId}
    Set Headers    {"Accept":"application/json"}
124
    Set Headers    {"Content-Type":"*/*"}
Elian Kraja's avatar
Elian Kraja committed
125
    Set Headers    {"Authorization":"${TOKEN}"}
126
    Get    ${apiRoot}/${apiName}/${apiVersion}/grants/${grantId}    allow_redirects=false
Elian Kraja's avatar
Elian Kraja committed
127
128
129
130
131
    ${output}=    Output    response
    Set Suite Variable    ${response}    ${output}