Commit be1cd5e4 authored by Benjamin Hebgen's avatar Benjamin Hebgen
Browse files

Merge branch 'fix/jsonldContext' into 'develop'

Fix/jsonld context

See merge request !186
parents b916dea3 d548e5f4
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -13,41 +13,41 @@ ${reason_200}= OK
${reason_204}=      No Content


*** Test Cases ***    DETAILS    KIND    COUNT
*** Test Cases ***    DETAILS    KIND
052_01_01 List @contexts with neither details or kind and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ${EMPTY}    1
    ${EMPTY}    ${EMPTY}
052_01_02 List @contexts with no details and kind equal to hosted and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Hosted    0
    ${EMPTY}    Hosted
052_01_03 List @contexts with no details and kind equal to cached and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Cached    1
    ${EMPTY}    Cached
052_01_04 List @contexts with no details and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ImplicitlyCreated    0
    ${EMPTY}    ImplicitlyCreated
052_01_05 List @contexts with details equal to false and no kind and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ${EMPTY}    1
    false    ${EMPTY}
052_01_06 List @contexts with details equal to false and kind equal to hosted and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Hosted    0
    false    Hosted
052_01_07 List @contexts with details equal to false and kind equal to cached and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Cached    1
    false    Cached
052_01_08 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ImplicitlyCreated    0
    false    ImplicitlyCreated


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

	${empty_array}=    Create List
    Check Response Status Code    200    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_200}
    Check Context Response Body Containing a list of identifiers
    ...    response_body=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${empty_array}
+13 −26
Original line number Diff line number Diff line
@@ -16,31 +16,20 @@ ${reason_200}= OK
${reason_204}=          No Content


*** Test Cases ***    DETAILS    KIND    COUNT
*** Test Cases ***    DETAILS    KIND
052_02_01 List @contexts with neither details or kind and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ${EMPTY}    2
    ${EMPTY}    ${EMPTY}
052_02_02 List @contexts with no details and kind equal to hosted and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Hosted    1
052_02_03 List @contexts with no details and kind equal to cached and with previously one add @context
    ${EMPTY}    Hosted
052_02_03 List @contexts with details equal to false and no kind and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Cached    1
052_02_04 List @contexts with no details and kind equal to implicitlycreated and with previously one add @context
    false    ${EMPTY}
052_02_04 List @contexts with details equal to false and kind equal to hosted and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ImplicitlyCreated    0
052_02_05 List @contexts with details equal to false and no kind and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ${EMPTY}    2
052_02_06 List @contexts with details equal to false and kind equal to hosted and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Hosted    1
052_02_07 List @contexts with details equal to false and kind equal to cached abd with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Cached    1
052_02_08 List @contexts with details equal to false and kind equal to implicitlycreated and with previously one add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ImplicitlyCreated    0
    false    Hosted



*** Keywords ***
@@ -54,17 +43,15 @@ Create Initial @context

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

    [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 of identifiers
    ...    response_body=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${uri_list}
    ...    kind=${kind}
    ...    ${response.json()}
    ...    ${uri_list}
    ...    ${kind}
    ...    ${FALSE}

Delete Initial @context
    Delete a @context    ${uri_list[0]}
+13 −24
Original line number Diff line number Diff line
@@ -18,31 +18,20 @@ ${reason_200}= OK
${reason_204}=          No Content


*** Test Cases ***    DETAILS    KIND    COUNT
*** Test Cases ***    DETAILS    KIND
052_03_01 List @contexts with neither details or kind and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ${EMPTY}    4
    ${EMPTY}    ${EMPTY}
052_03_02 List @contexts with no details and kind equal to hosted and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Hosted    3
052_03_03 List @contexts with no details and kind equal to cached and with previously several add @context
    ${EMPTY}    Hosted
052_03_03 List @contexts with details equal to false and no kind and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Cached    1
052_03_04 List @contexts with no details and kind equal to implicitlycreated and with previously several add @context
    false    ${EMPTY}
052_03_04 List @contexts with details equal to false and kind equal to hosted and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ImplicitlyCreated    0
052_03_05 List @contexts with details equal to false and no kind and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ${EMPTY}    4
052_03_06 List @contexts with details equal to false and kind equal to hosted and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Hosted    3
052_03_07 List @contexts with details equal to false and kind equal to cached abd with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Cached    1
052_03_08 List @contexts with details equal to false and kind equal to implicitlycreated and with previously several add @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ImplicitlyCreated    0
    false    Hosted



*** Keywords ***
@@ -70,17 +59,17 @@ Create Initial set of @contexts

List @contexts with several previous created @context
    [Documentation]    Check that one can list @contexts
    [Arguments]    ${details}    ${kind}    ${count}
    [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 of identifiers
    ...    response_body=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${uri_list}
    ...    kind=${kind}
    ...    ${response.json()}
    ...    ${uri_list}
    ...    ${kind}
    ...    ${FALSE}

Delete Initial @contexts
    FOR    ${uri}    IN    @{uri_list}
+17 −15
Original line number Diff line number Diff line
@@ -18,19 +18,20 @@ ${reason_200}= OK
${reason_204}=          No Content


*** Test Cases ***    DETAILS    KIND    COUNT
*** Test Cases ***    DETAILS    KIND
052_05_01 List @contexts with details set to true and no kind and with previously several add @contexts
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    true    ${EMPTY}    4
    true    ${EMPTY}
052_05_02 List @contexts with details set to true and kind set to hosted and with previously several add @contexts
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    true    Hosted    3
052_05_03 List @contexts with details set to true and kind set to cached abd with previously several add @contexts
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    true    Cached    1
052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    true    ImplicitlyCreated    0
    true    Hosted
#move to new tests this doesn't work like this. cached need to run differently 
#052_05_03 List @contexts with details set to true and kind set to cached abd with previously several add @contexts
#    [Tags]    ctx-list    5_13_3    since_v1.5.1
#    true    Cached
#052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts
#    [Tags]    ctx-list    5_13_3    since_v1.5.1
#    true    ImplicitlyCreated


*** Keywords ***
@@ -58,7 +59,7 @@ Create Initial set of @contexts

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

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

@@ -66,10 +67,11 @@ List @contexts with several previous created @context
    Check Response Reason set to    ${response.reason}    ${reason_200}

    # One needs to check the list of responses
    Check Context Response Body Containing a JSONObject with details of the @contexts
    ...    response=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${uris}
    Check Context Response Body Containing a list of identifiers
    ...    ${response.json()}
    ...    ${uris}
    ...    ${kind}
    ...    ${TRUE}

Delete Initial @contexts
    FOR    ${uri}    IN    @{uris}
+36 −23
Original line number Diff line number Diff line
@@ -17,45 +17,58 @@ ${reason_200}= OK
${reason_204}=                          No Content


*** Test Cases ***    DETAILS    KIND    COUNT
*** Test Cases ***    DETAILS    KIND
052_06_01 List @contexts with neither details or kind and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ${EMPTY}    4
    ${EMPTY}    ${EMPTY}
052_06_02 List @contexts with no details and kind set to hosted and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Hosted    0
    ${EMPTY}    Hosted
052_06_03 List @contexts with no details and kind set to cached and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    Cached    3
    ${EMPTY}    Cached
052_06_04 List @contexts with no details and kind set to implicitlycreated and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    ${EMPTY}    ImplicitlyCreated    1
    ${EMPTY}    ImplicitlyCreated
052_06_05 List @contexts with details set to false and no kind and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ${EMPTY}    4
    false    ${EMPTY}
052_06_06 List @contexts with details set to false and kind equal to hosted and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Hosted    0
    false    Hosted
052_06_07 List @contexts with details set to false and kind equal to cached and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    Cached    3
    false    Cached
052_06_08 List @contexts with details set to false and kind equal to implicitlycreated and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3    since_v1.5.1
    false    ImplicitlyCreated    1
    false    ImplicitlyCreated


*** Keywords ***
List @contexts with no previous created @context
    [Documentation]    Check that one can list @contexts
    [Arguments]    ${details}    ${kind}    ${count}
    [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}
    
    IF    '${kind}' == 'Hosted'
        ${entryFound}=    Run Keyword And Return Status    Check Context Response Body Containing a list of identifiers    ${response.json()}    ${list_contexts}    ${kind}
        Should Not Be True    ${entryFound}
    ELSE IF    '${kind}' == 'ImplicitlyCreated'
        ${tmp}=    Create List    ${implicit_id}
        Check Context Response Body Containing a list of identifiers
        ...    ${response.json()}
        ...    ${tmp}
        ...    ${kind}
    ELSE IF    '${kind}' == 'Cached' or '{$kind}' == ''
        Check Context Response Body Containing a list of identifiers
    ...    response_body=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${list_contexts}
        ...    ${response.json()}
        ...    ${list_contexts}
        ...    ${kind}
    END


Create initial ImplicitlyCreated @context
    ${subscription_payload}=    Load JSON From File    ${EXECDIR}/data/${subscription_payload_file_path}
@@ -71,20 +84,20 @@ Create initial ImplicitlyCreated @context
    ...    ${subscription_payload_file_path}
    ...    ${CONTENT_TYPE_LD_JSON}

    ${response}=    List @contexts    true    ImplicitlyCreated
    ${response}=    Retrieve Subscription    ${subscription_id}
    ${implicit_id}=    Get From Dictionary    ${response.json()}    jsonldContext
    ${implicit_id}=    Evaluate    '${implicit_id}'.split('/')[-1]

    Set Global Variable    ${implicit_id}
    Set Suite Variable    ${subscription_id}
    Set Suite Variable    ${list_contexts}
    ${response}=    Serve a @context    ${implicit_id}
    Check Response Status Code    200    ${response.status_code}
	
    ${data}=    Get From List    ${response.json()}    0
    ${implicit_id}=    Get From Dictionary    ${data}    URL
    Append To List    ${list_contexts}    ${implicit_id}
    ${data}=    Set Variable    ${response.json()}
    
    Check Context Response Body Containing numberOfHits value    ${data}    1

    Set Global Variable    ${implicit_id}
    Set Suite Variable    ${subscription_id}
    Set Suite Variable    ${list_contexts}

Delete Initial @context Data
    Delete Subscription    ${subscription_id}
    FOR    ${uri}    IN    @{list_contexts}
Loading