Commit 5acc1e2f authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

fix(013_02): use correct arguments and checks for pagination

parent 9414ea36
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -13,24 +13,24 @@ ${first_subscription_payload_file_path}= subscriptions/subscription-sample.js
${second_subscription_payload_file_path}=    subscriptions/subscription-watchedAttributes-sample.jsonld
${third_subscription_payload_file_path}=    subscriptions/subscription-inactive-sample.jsonld

*** Test Cases ***    LIMIT     PAGE         EXPECTED_SUBSCRIPTION_NUMBER    PREV_LINK                                                                           NEXT_LINK
*** Test Cases ***    LIMIT     OFFSET      EXPECTED_SUBSCRIPTION_NUMBER    PREV_LINK                                                                           NEXT_LINK
Query Second Subscription
                      ${1}      ${2}         ${1}                            </ngsi-ld/v1/subscriptions?limit=1&page=1>;rel="prev";type="application/ld+json"    </ngsi-ld/v1/subscriptions?limit=1&page=3>;rel="next";type="application/ld+json"
                      ${1}      ${1}         ${1}                            </ngsi-ld/v1/subscriptions?limit=1&offset=0>;rel="prev";type="application/ld+json"    </ngsi-ld/v1/subscriptions?limit=1&offset=2>;rel="next";type="application/ld+json"
                      [Tags]    sub-query    5_8_4

Query Last Subscription
                      ${2}      ${2}         ${1}                            </ngsi-ld/v1/subscriptions?limit=2&page=1>;rel="prev";type="application/ld+json"    ${EMPTY}
                      ${1}      ${2}         ${1}                            </ngsi-ld/v1/subscriptions?limit=1&offset=1>;rel="prev";type="application/ld+json"    ${EMPTY}
                      [Tags]    sub-query    5_8_4

Query All Subscriptions
                      ${15}     ${1}         ${3}                            ${EMPTY}                                                                            ${EMPTY}
                      ${15}     ${0}         ${3}                            ${EMPTY}                                                                            ${EMPTY}
                      [Tags]    sub-query    5_8_4

*** Keywords ***
Query Subscriptions With Limit And Page Parameters
    [Arguments]    ${limit}    ${page}    ${expectation_subscription_number}    ${prev_link}    ${next_link}
    [Arguments]    ${limit}    ${offset}    ${expectation_subscription_number}    ${prev_link}    ${next_link}
    [Documentation]    Check that you can query a list of subscriptions: Pagination logic shall be in place
    Query Subscriptions    context=${ngsild_test_suite_context}    limit=${limit}    page=${page}
    Query Subscriptions    context=${ngsild_test_suite_context}    limit=${limit}    offset=${offset}   accept=${CONTENT_TYPE_LD_JSON}
    Check Response Status Code Set To    200
    Check Response Body Containing Number Of Entities    Subscription    ${expectation_subscription_number}
    Check Pagination Prev And Next Headers    ${prev_link}    ${next_link}
+2 −2
Original line number Diff line number Diff line
@@ -730,13 +730,13 @@ Delete Subscription
    [return]   ${response}

Query Subscriptions
    [Arguments]  ${context}=${EMPTY}    ${limit}=${EMPTY}   ${page}=${EMPTY}    ${accept}=${EMPTY}
    [Arguments]  ${context}=${EMPTY}    ${limit}=${EMPTY}   ${offset}=${EMPTY}    ${accept}=${EMPTY}

    &{headers}=  Create Dictionary
    &{params}=  Create Dictionary
    Run Keyword If     '${context}'!=''       Set To Dictionary   ${headers}    Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json"
    Run Keyword If     '${limit}'!=''       Set To Dictionary   ${params}    limit=${limit}
    Run Keyword If     '${page}'!=''       Set To Dictionary   ${params}    page=${page}
    Run Keyword If     '${offset}'!=''       Set To Dictionary   ${params}    offset=${offset}
    Run Keyword If     '${accept}'!=''       Set To Dictionary   ${headers}   Accept    ${accept}

    ${response}=  GET  ${SUBSCRIPTION_ENDPOINT_PATH}     headers=${headers}     query=${params}
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ Check NotificationParams
Check Pagination Prev And Next Headers
    [Arguments]  ${prev_link}    ${next_link}
    ${expected_links}=   Create List     ${prev_link}    ${next_link}
    Run Keyword If     '${prev_link}'!='' and '${next_link}'!=''       Lists Should Be Equal    ${response['headers']['Link']}    ${expected_links}   ignore_order=True
    Run Keyword If     '${prev_link}'!='' and '${next_link}'!=''       Lists Should Be Equal    ${response['headers']['Link'].replace(" ", "").split(',')}    ${expected_links}   ignore_order=True
    Run Keyword If     '${prev_link}'!='' and '${next_link}'==''       Should Be Equal      ${response['headers']['Link']}    ${prev_link}
    Run Keyword If     '${prev_link}'=='' and '${next_link}'!=''       Should Be Equal      ${response['headers']['Link']}    ${next_link}