Commit 8540e279 authored by Ranim Naimi's avatar Ranim Naimi Committed by Benoit Orihuela
Browse files

feat: add test cases for observationSpace and operationSpace geospatial properties

parent bf531b5e
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that an entity with observationSpace geospatial Property can be retrieved

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Setup         Create Initial Entity
Suite Teardown      Delete Created Entity
Test Template       Retrieve Entity With observationSpace Geospatial Property


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:
${filename}=                building-observation-space-geoproperty.jsonld


*** Test Cases ***    OPTIONS    EXPECTATION_FILENAME
018_08_01 Simplified
    [Tags]    e-retrieve    5_7_1    4_7
    keyValues    building-observation-space-geoproperty-simplified.jsonld
018_08_02 Normalized
    [Tags]    e-retrieve    5_7_1    4_7
    ${EMPTY}    building-observation-space-geoproperty-normalized.jsonld


*** Keywords ***
Retrieve Entity With observationSpace Geospatial Property
    [Documentation]    Check that an entity with observationSpace geospatial Property can be retrieved
    [Arguments]    ${options}    ${expectation_filename}
    ${response}=    Query Entity
    ...    id=${entity_id}
    ...    options=${options}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Entity element    ${expectation_filename}    ${entity_id}    ${response.json()}

Create Initial Entity
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

Delete Created Entity
    Delete Entity by Id    ${entity_id}
+49 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that an entity with operationSpace geospatial Property can be retrieved

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Setup         Create Initial Entity
Suite Teardown      Delete Created Entity
Test Template       Retrieve Entity With operationSpace Geospatial Property


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:
${filename}=                building-operation-space-geoproperty.jsonld


*** Test Cases ***    OPTIONS    EXPECTATION_FILENAME
018_09_01 Simplified
    [Tags]    e-retrieve    5_7_1    4_7
    keyValues    building-operation-space-geoproperty-simplified.jsonld
018_09_02 Normalized
    [Tags]    e-retrieve    5_7_1    4_7
    ${EMPTY}    building-operation-space-geoproperty-normalized.jsonld


*** Keywords ***
Retrieve Entity With operationSpace Geospatial Property
    [Documentation]    Check that an entity with operationSpace geospatial Property can be retrieved
    [Arguments]    ${options}    ${expectation_filename}
    ${response}=    Query Entity
    ...    id=${entity_id}
    ...    options=${options}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Entity element    ${expectation_filename}    ${entity_id}    ${response.json()}

Create Initial Entity
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

Delete Created Entity
    Delete Entity by Id    ${entity_id}
+44 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can create an entity with observationSpace geospatial Property

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Test Teardown       Delete Initial Entity


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:
${filename}=                building-observation-space-geoproperty.jsonld
${content_type}=            application/ld+json


*** Test Cases ***
001_12 Create Entity With observationSpace Geospatial Property
    [Documentation]    Check that one can create an entity with observationSpace geospatial Property
    [Tags]    e-create    5_6_1    4_7

    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Test Variable    ${entity_id}

    ${response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${entity_id}
    ...    ${content_type}

    Check Response Status Code    201    ${response.status_code}
    Check Response Headers Containing URI set to    ${entity_id}    ${response.headers}
    ${created_entity}=    Load Test Sample    entities/${filename}    ${entity_id}
    ${response1}=    Retrieve Entity by Id
    ...    id=${entity_id}
    ...    context=${ngsild_test_suite_context}
    Check Created Resource Set To
    ...    created_resource=${created_entity}
    ...    response_body=${response1.json()}


*** Keywords ***
Delete Initial Entity
    Delete Entity by Id    ${entity_id}
+44 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can create an entity with operationSpace geospatial Property

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Test Teardown       Delete Initial Entity


*** Variables ***
${building_id_prefix}=      urn:ngsi-ld:Building:
${filename}=                building-operation-space-geoproperty.jsonld
${content_type}=            application/ld+json


*** Test Cases ***
001_13 Create Entity With operationSpace Geospatial Property
    [Documentation]    Check that one can create an entity with operationSpace geospatial Property
    [Tags]    e-create    5_6_1    4_7

    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Test Variable    ${entity_id}

    ${response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${entity_id}
    ...    ${content_type}

    Check Response Status Code    201    ${response.status_code}
    Check Response Headers Containing URI set to    ${entity_id}    ${response.headers}
    ${created_entity}=    Load Test Sample    entities/${filename}    ${entity_id}
    ${response1}=    Retrieve Entity by Id
    ...    id=${entity_id}
    ...    context=${ngsild_test_suite_context}
    Check Created Resource Set To
    ...    created_resource=${created_entity}
    ...    response_body=${response1.json()}


*** Keywords ***
Delete Initial Entity
    Delete Entity by Id    ${entity_id}
+47 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can append an observationSpace geospatial Property to an entity

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Test Setup          Create Initial Entity
Test Teardown       Delete Initial Entity


*** Variables ***
${building_id_prefix}=                      urn:ngsi-ld:Building:
${filename}=                                building-minimal.jsonld
${observation_space_fragment_filename}=     observation-space-fragment.json
${expectation_filename}=                    building-observation-space-geoproperty-normalized.jsonld


*** Test Cases ***
010_08 Append observationSpace geospatial Property to an entity
    [Documentation]    Check that one can append an observationSpace geospatial Property to an entity
    [Tags]    ea-append    5_6_3    4_7
    ${response}=    Append Entity Attributes
    ...    ${entity_id}
    ...    ${observation_space_fragment_filename}
    ...    ${CONTENT_TYPE_JSON}
    Check Response Status Code    204    ${response.status_code}
    ${entity_expectation_payload}=    Load Test Sample    entities/expectations/${expectation_filename}    ${entity_id}
    ${response}=    Retrieve Entity by Id
    ...    ${entity_id}
    ...    accept=${CONTENT_TYPE_JSON}
    ...    context=${ngsild_test_suite_context}
    Check Updated Resource Set To    ${entity_expectation_payload}    ${response.json()}


*** Keywords ***
Create Initial Entity
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Test Variable    ${entity_id}
    ${response}=    Create Entity
    ...    ${filename}
    ...    ${entity_id}
    Check Response Status Code    201    ${response.status_code}

Delete Initial Entity
    Delete Entity by Id    ${entity_id}
Loading