019_01_04.robot 2.61 KB
Newer Older
root's avatar
root committed
*** Settings ***
Documentation       Check that you can query several entities based on attribute names

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

Suite Teardown      Delete Entities


*** Variables ***
${building_id_prefix}=              urn:ngsi-ld:Building:
${filename}=                        building-simple-attributes-sample.jsonld
${filename2}=                       building-minimal-sample.jsonld
${expectation_filename}=            building-attributes-query-expectation.json
${entity_type}=                     https://ngsi-ld-test-suite/context#Building
${attribute_airqualitylevel}=       https://ngsi-ld-test-suite/context#airQualityLevel
${attribute_subcategory}=           https://ngsi-ld-test-suite/context#subCategory
lopesg's avatar
lopesg committed
Query several entities based on attribute names
    [Documentation]    Check that you can query several entities based on attribute names
    [Tags]    e-query    5_7_2
    ${first_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Suite Variable    ${first_entity_id}
poujol's avatar
poujol committed
    ${response}=    Create Entity Selecting Content Type
    ...    ${filename}
    ...    ${first_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
poujol's avatar
poujol committed
    Check Response Status Code    201    ${response.status_code}
    ${second_entity_id}=    Generate Random Entity Id    ${building_id_prefix}
    Set Suite Variable    ${second_entity_id}
poujol's avatar
poujol committed
    ${response}=    Create Entity Selecting Content Type
    ...    ${filename2}
    ...    ${second_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
poujol's avatar
poujol committed
    Check Response Status Code    201    ${response.status_code}
    ${attributes_to_be_retrieved}=    Catenate
    ...    SEPARATOR=,
    ...    ${attribute_airqualitylevel}
    ...    ${attribute_subcategory}
    @{entities_ids_to_be_compared}=    Create List    ${first_entity_id}
root's avatar
root committed
    ${response}=    Query Entities    attrs=${attributes_to_be_retrieved}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing Entity elements
    ...    ${expectation_filename}
    ...    ${entities_ids_to_be_compared}
    ...    ${response.json()}

poujol's avatar
poujol committed
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing Entity elements
    ...    ${expectation_filename}
    ...    ${entities_ids_to_be_compared}
poujol's avatar
poujol committed
    ...    ${response.json()}
root's avatar
root committed
*** Keywords ***
Delete Entities
    Delete Entity by Id Returning Response    ${first_entity_id}
    Delete Entity by Id Returning Response    ${second_entity_id}