Commit bb2e934d authored by lopezaguilar's avatar lopezaguilar
Browse files

Adding permutations in the List @context operation

parent e986c49a
Loading
Loading
Loading
Loading
+54 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can list all the @context available in the broker with no previous add @context

Resource            ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource
Resource            ${EXECDIR}/resources/HttpUtils.resource
Library             Collections

Test Template       List @contexts with no previous created @context


*** Variables ***
${filename}=        @context-minimal-valid.json
${reason_200}=      OK
${reason_204}=      No Content


*** Test Cases ***    DETAILS    KIND
052_01_01 List @contexts with neither details or kind and not previously created @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    ${EMPTY}
052_01_02 List @contexts with no details and kind equal to hosted and not previously created @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    hosted
052_01_03 List @contexts with no details and kind equal to cached and not previously created @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    cached
052_01_04 List @contexts with no details and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    implicitlycreated
052_01_05 List @contexts with details equal to false and no kind and not previously created @context
    [Tags]    ctx-serve    5_13_4
    false    ${EMPTY}
052_01_06 List @contexts with details equal to false and kind equal to hosted and not previously created @context
    [Tags]    ctx-serve    5_13_4
    false    hosted
052_01_07 List @contexts with details equal to false and kind equal to cached and not previously created @context
    [Tags]    ctx-serve    5_13_4
    false    cached
052_01_08 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-serve    5_13_4
    false    implicitlycreated


*** Keywords ***
List @contexts with no previous created @context
    [Documentation]    Check that you can list @contexts
    [Arguments]    ${details}    ${kind}
    ${response}=    List @contexts    ${details}    ${kind}

    Check Response Status Code    200    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_200}
    Check Context Response Body Containing a list with one URL equal to default @context    ${response.json()}
+68 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can list all the @context available in the broker with one add @context

Resource            ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource
Resource            ${EXECDIR}/resources/HttpUtils.resource
Library             Collections

Test Setup          Create Initial @context
Test Teardown       Delete Initial @context
Test Template       List @contexts with one previous created @context


*** Variables ***
${first_filename}=      @context-minimal-valid.json
${reason_200}=          OK
${reason_204}=          No Content


*** Test Cases ***    DETAILS    KIND
052_02_01 List @contexts with neither details or kind and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    ${EMPTY}
052_02_02 List @contexts with no details and kind equal to hosted and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    hosted
052_02_03 List @contexts with no details and kind equal to cached and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    cached
052_02_04 List @contexts with no details and kind equal to implicitlycreated and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    implicitlycreated
052_02_05 List @contexts with details equal to false and no kind and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    false    ${EMPTY}
052_02_06 List @contexts with details equal to false and kind equal to hosted and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    false    hosted
052_02_07 List @contexts with details equal to false and kind equal to cached abd with previously one add @context
    [Tags]    ctx-serve    5_13_4
    false    cached
052_02_08 List @contexts with details equal to false and kind equal to implicitlycreated and with previously one add @context
    [Tags]    ctx-serve    5_13_4
    false    implicitlycreated


*** Keywords ***
Create Initial @context
    ${response}=    Add a new @context    ${first_filename}
    Check Response Status Code    201    ${response.status_code}
    ${uri}=    Fetch Id From Response Location Header    ${response.headers}
    Set Suite Variable    ${uri}

List @contexts with one previous created @context
    [Documentation]    Check that you can list @contexts
    [Arguments]    ${details}    ${kind}

    ${response}=    List @contexts    ${details}    ${kind}

    Check Response Status Code    200    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_200}
    Check Context Response Body Containing a list with more than one URL    ${response.json()}    2    ${uri}

Delete Initial @context
    ${response_delete}=    Delete a @context without reload    ${uri}
    Check Response Status Code    204    ${response_delete.status_code}
    Check Response Reason set to    ${response_delete.reason}    ${reason_204}
+90 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can list all the @context available in the broker with several add @contexts

Resource            ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource
Resource            ${EXECDIR}/resources/HttpUtils.resource
Library             Collections

Test Setup          Create Initial set of @contexts
Test Teardown       Delete Initial @contexts
Test Template       List @contexts with several previous created @context


*** Variables ***
${first_filename}=      @context-minimal-valid.json
${second_filename}=     @context-minimal-second-valid.json
${third_filename}=      @context-minimal-third-valid.json
${reason_200}=          OK
${reason_204}=          No Content


*** Test Cases ***    DETAILS    KIND
052_03_01 List @contexts with neither details or kind and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    ${EMPTY}
052_03_02 List @contexts with no details and kind equal to hosted and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    hosted
052_03_03 List @contexts with no details and kind equal to cached and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    cached
052_03_04 List @contexts with no details and kind equal to implicitlycreated and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    implicitlycreated
052_03_05 List @contexts with details equal to false and no kind and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    false    ${EMPTY}
052_03_06 List @contexts with details equal to false and kind equal to hosted and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    false    hosted
052_03_07 List @contexts with details equal to false and kind equal to cached abd with previously several add @context
    [Tags]    ctx-serve    5_13_4
    false    cached
052_03_08 List @contexts with details equal to false and kind equal to implicitlycreated and with previously several add @context
    [Tags]    ctx-serve    5_13_4
    false    implicitlycreated


*** Keywords ***
Create Initial set of @contexts
    ${response}=    Add a new @context    ${first_filename}
    Check Response Status Code    201    ${response.status_code}
    ${first_uri}=    Fetch Id From Response Location Header    ${response.headers}
    Set Suite Variable    ${first_uri}

    ${response}=    Add a new @context    ${second_filename}
    Check Response Status Code    201    ${response.status_code}
    ${second_uri}=    Fetch Id From Response Location Header    ${response.headers}
    Set Suite Variable    ${second_uri}

    ${response}=    Add a new @context    ${third_filename}
    Check Response Status Code    201    ${response.status_code}
    ${third_uri}=    Fetch Id From Response Location Header    ${response.headers}
    Set Suite Variable    ${third_uri}

    @{uris}=    Create List
    Append To List    ${uris}    ${first_uri}
    Append To List    ${uris}    ${second_uri}
    Append To List    ${uris}    ${third_uri}
    Set Suite Variable    ${uris}

List @contexts with several previous created @context
    [Documentation]    Check that you can list @contexts
    [Arguments]    ${details}    ${kind}

    ${response}=    List @contexts    ${details}    ${kind}

    Check Response Status Code    200    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_200}
    Check Context Response Body Containing a list with several URLs    ${response.json()}    4    ${uris}

Delete Initial @contexts
    FOR    ${uri}    IN    @{uris}
        Log    URI: ${uri}

        ${response_delete}=    Delete a @context without reload    ${uri}
        Check Response Status Code    204    ${response_delete.status_code}
        Check Response Reason set to    ${response_delete.reason}    ${reason_204}
    END
+45 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you get an error when try to list @context with wrong details or kind

Resource            ${EXECDIR}/resources/ApiUtils/JSON-LD@ContextServer.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource
Resource            ${EXECDIR}/resources/HttpUtils.resource
Library             Collections

Test Template       List @contexts with no previous created @context


*** Variables ***
${filename}=        @context-minimal-valid.json
${reason_400}=      Bad Request
${reason_204}=      No Content


*** Test Cases ***    DETAILS    KIND
052_04_01 List @contexts with no details and kind equal to other and not previously created @context
    [Tags]    ctx-serve    5_13_4
    ${EMPTY}    other
052_04_02 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-serve    5_13_4
    other    ${EMPTY}
052_04_03 List @contexts with details equal to false and kind equal to other and not previously created @context
    [Tags]    ctx-serve    5_13_4
    other    other
052_04_04 List @contexts with no details and kind equal to other and not previously created @context
    [Tags]    ctx-serve    5_13_4
    true    other
052_04_05 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-serve    5_13_4
    other    hosted


*** Keywords ***
List @contexts with no previous created @context
    [Documentation]    Check that you can list @contexts
    [Arguments]    ${details}    ${kind}
    ${response}=    List @contexts    ${details}    ${kind}

    Check Response Status Code    400    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_400}
    Check Response Body Containing ProblemDetails Element    ${response.json()}    ${ERROR_TYPE_BAD_REQUEST_DATA}
+7 −0
Original line number Diff line number Diff line
{
    "@context": {
        "B1": "urn:ngsi-ld:attributes:B1",
        "B2": "urn:ngsi-ld:attributes:B2",
        "B3": "urn:ngsi-ld:attributes:B3"
    }
}
Loading