Commit b182d85d authored by Marco Cavalli's avatar Marco Cavalli
Browse files

Merge branch 'milestone-c' into 'develop'

Milestone c

See merge request !195
parents 03b4bbfe 01652216
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
*** Settings ***
Documentation       If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.
Documentation       If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it shall contain the total number of matching results.

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
@@ -30,7 +30,7 @@ ${airQualityLevel}= airQualityLevel==6

*** Keywords ***
Query Entities With Count
    [Documentation]    If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.
    [Documentation]    If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it shall contain the total number of matching results.
    [Arguments]    ${q}    ${expected_status_code}    ${expected_count}
    ${response}=    Query Entities
    ...    entity_types=${entity_type}
+0 −4
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Test Setup          Setup Initial Context Source Registrations
Test Teardown       Delete Created Context Source Registrations


*** Variables ***
@@ -38,6 +37,3 @@ Setup Initial Context Source Registrations
    ${create_response}=    Create Context Source Registration With Return    ${updated_payload}
    Check Response Status Code    201    ${create_response.status_code}
    Set Test Variable    ${registration_id}

Delete Created Context Source Registrations
    Delete Context Source Registration    ${registration_id}
+26 −7
Original line number Diff line number Diff line
@@ -8,31 +8,50 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Teardown      Delete Created Context Source Registrations
Test Template       Create Context Source Registration


*** Variables ***
${registration_payload_file_path}=      csourceRegistrations/context-source-registration-with-expiration.jsonld


*** Test Cases ***
033_01_01 Create Context Source Registration With Specific Date Expiration Date
    [Documentation]    Check that one can create a context source registration with specific ID and expiration date
*** Test Cases ***    FILENAME    HAS_MODE
033_01_01 Create Context Source Registration Without Mode And Operation
    [Tags]    csr-create    5_9_2
    csourceRegistrations/context-source-registration.jsonld
033_01_02 Create Context Source Registration With Non Default Mode And Operations
    [Tags]    csr-create    5_9_2    since_v1.6.1
    csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld    ${True}
033_01_03 Create Context Source Registration With Location
    [Tags]    csr-create    5_9_2
    csourceRegistrations/context-source-registration-location.jsonld
033_01_04 Create Context Source Registration With Specific Date Expiration Date
    [Tags]    csr-create    5_9_2
    csourceRegistrations/context-source-registration-with-expiration.jsonld


*** Keywords ***
Create Context Source Registration
    [Documentation]    Check that one can create a context source registration with specific ID and expiration date
    [Arguments]    ${registration_payload_file_path}    ${has_mode}=${False}
    ${registration_id}=    Generate Random CSR Id
    Set Suite Variable    ${registration_id}
    ${payload}=    Load JSON From File    ${EXECDIR}/data/${registration_payload_file_path}
    ${registration_payload}=    Update Value To JSON    ${payload}    $..id    ${registration_id}
    ${registration_payload}=    Update Value To JSON    ${payload}    $.id    ${registration_id}
    ${response}=    Create Context Source Registration With Return    ${registration_payload}
    Check Response Status Code    201    ${response.status_code}
    Check Response Body Is Empty    ${response}
    Check Response Headers Containing URI set to    ${registration_id}    ${response.headers}
    ${response1}=    Retrieve Context Source Registration
    ...    context_source_registration_id=${registration_id}
    ...    context=${ngsild_test_suite_context}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=    Create List    ${status_regex_expr}
    Check Created Resource Set To    ${registration_payload}    ${response1.json()}    ${ignored_attributes}

    IF    ${has_mode} == ${False}
        Append To List    ${ignored_attributes}    mode    operations
    END

    Check Created Resource Set To    ${registration_payload}    ${response1.json()}    ${ignored_attributes}

*** Keywords ***
Delete Created Context Source Registrations
    Delete Context Source Registration    ${registration_id}
+0 −39
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can create a context source registration that never expires

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Teardown      Delete Created Context Source Registrations


*** Variables ***
${registration_payload_file_path}=      csourceRegistrations/context-source-registration.jsonld


*** Test Cases ***
033_01_02 Create Context Source Registration That Never Expires
    [Documentation]    Check that one can create a context source registration that never expires
    [Tags]    csr-create    5_9_2
    ${registration_id}=    Generate Random CSR Id
    Set Suite Variable    ${registration_id}
    ${payload}=    Load JSON From File    ${EXECDIR}/data/${registration_payload_file_path}
    ${registration_payload}=    Update Value To JSON    ${payload}    $..id    ${registration_id}
    ${response}=    Create Context Source Registration With Return    ${registration_payload}
    Check Response Status Code    201    ${response.status_code}
    Check Response Body Is Empty    ${response}
    Check Response Headers Containing URI set to    ${registration_id}    ${response.headers}
    ${response1}=    Retrieve Context Source Registration
    ...    context_source_registration_id=${registration_id}
    ...    context=${ngsild_test_suite_context}
    ...    accept=${CONTENT_TYPE_LD_JSON}
    ${ignored_attributes}=    Create List    ${status_regex_expr}
    Check Created Resource Set To    ${registration_payload}    ${response1.json()}    ${ignored_attributes}


*** Keywords ***
Delete Created Context Source Registrations
    Delete Context Source Registration    ${registration_id}
+4 −4
Original line number Diff line number Diff line
@@ -12,12 +12,12 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi


*** Test Cases ***
033_02_01 Create a context source registration with invalid JSON file
    [Documentation]    Create a context source registration with invalid JSON file
033_02_01 Create a context source registration with invalid content
    [Documentation]    Check that one cannot create a context source with invalid content
    [Tags]    csr-create    5_9_2
    ${subscription_payload}=    Get File    ${EXECDIR}/data/${registration_payload_file_path}
    ${csr_payload}=    Load JSON From File    ${EXECDIR}/data/${registration_payload_file_path}
    ${response}=    Create Context Source Registration
    ...    ${subscription_payload}
    ...    ${csr_payload}
    Check Response Status Code    400    ${response.status_code}
    Check Response Body Type When Using Session Request    ${response.json()}    ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Title When Using Session Request    ${response.json()}
Loading