IndividualPmJob.robot 3.65 KB
Newer Older
1
2
*** Settings ***
Library           JSONSchemaLibrary    schemas/
Elian Kraja's avatar
Elian Kraja committed
3
Resource          environment/variables.txt    # Generic Parameters
4
5
6
7
8
9
10
11
Library           JSONLibrary
Resource          environment/IndividualPmJob.txt
Library           REST    ${VNFM_SCHEMA}://${VNFM_HOST}:${VNFM_PORT}

*** Test Cases ***
GET Individual PM Job
    Log    Trying to get a Pm Job present in the NFVO Catalogue
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
12
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
13
14
15
16
17
18
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    200
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    Log    Trying to validate response
    ${result}=    Output    response body
Elian Kraja's avatar
Elian Kraja committed
19
    Validate Json    PmJob.schema.json    ${result}
20
21
22
23
24
    Log    Validation OK

GET Individual PM Job - Negative (Not Found)
    Log    Trying to perform a negative get, using erroneous PM Job identifier
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
25
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
26
27
28
29
30
31
32
    GET    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
    Integer    response status    404
    Log    Received 404 Not Found as expected
    ${contentType}=    Output    response headers Content-Type
    Should Contain    ${contentType}    ${CONTENT_TYPE_JSON}
    Log    Trying to validate ProblemDetails
    ${problemDetails}=    Output    response body
Elian Kraja's avatar
Elian Kraja committed
33
    Validate Json    ProblemDetails.schema.json    ${problemDetails}
34
35
36
37
38
    Log    Validation OK

DELETE Individual PM Job
    Log    Trying to delete an existing PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
39
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
40
41
42
43
44
45
46
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    204
    Log    Received 204 No Content as expected

DELETE Individual PM Job - Negative (Not Found)
    Log    Trying to delete an existing PM Job
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
47
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
48
49
50
51
52
53
54
    DELETE    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${erroneousPmJobId}
    Integer    response status    404
    Log    Received 204 No Content as expected

POST Individual PM Job - (Method not implemented)
    Log    Trying to perform a POST (method should not be implemented)
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
55
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
56
57
58
59
60
61
62
    POST    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected

PUT Individual PM Job - (Method not implemented)
    Log    Trying to perform a PUT. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
63
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
64
65
66
67
68
69
70
    PUT    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected

PATCH Individual PM Job - (Method not implemented)
    Log    Trying to perform a PATCH. This method should not be implemented
    Set Headers    {"Accept": "${ACCEPT_JSON}"}
Elian Kraja's avatar
Elian Kraja committed
71
    Run Keyword If    ${AUTH_USAGE} == 1    Set Headers    {"Authorization": "${AUTHORIZATION}"}
72
73
74
    PATCH    ${apiRoot}/${apiName}/${apiVersion}/pm_jobs/${pmJobId}
    Integer    response status    405
    Log    Received 405 Method not implemented as expected