Commit d2c33761 authored by root's avatar root
Browse files

added Consumption/Entity/004.robot

parent f8f65d09
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that the queried entity by Id can be returned in a simplified representation
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

*** Variable ***
${building_id_prefix}=  urn:ngsi-ld:Building:
${filename}=  building-simple-attributes-sample.jsonld
${expectation_filename}=  building-simple-attributes-sample-expectation-simplified.jsonld
${options_parameter}=  keyValues

*** Test Cases ***                                                 
004 Get an entity in a simplified representation          
    [Documentation]  Check that the queried entity by Id can be returned in a simplified representation
    [Tags]  mandatory    failing

    ${entity_id}=     Generate Random Entity Id    ${building_id_prefix}
    ${request}    ${response}=    Create Entity Selecting Content Type  ${filename}     ${entity_id}    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code  201    ${response['status']}

    ${response}=    Query Entity    ${entity_id}    ${CONTENT_TYPE_LD_JSON}    options=${options_parameter}
    Check Response Status Code  200    ${response['status']}
    Check Response Body Containing Entity element    ${expectation_filename}    ${entity_id}    ${response}

    [Teardown]  Delete Entity by Id Returning Response   ${entity_id}
 No newline at end of file
+11 −0
Original line number Diff line number Diff line
{
    "id": "urn:ngsi-ld:Building:4982132550789476",
        "type": "https://uri.fiware.org/ns/data-models#Building",
        "name": "Eiffel Tower",
        "https://uri.fiware.org/ns/data-models#airQualityLevel": 4,
        "https://uri.fiware.org/ns/data-models#almostFull": false,
        "https://uri.fiware.org/ns/data-models#subCategory": "tourism",
        "@context": [
            "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
    ]
}
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -65,14 +65,16 @@ Delete Entity by Id
    Output  response

Query Entity
    [Arguments]  ${id}     ${accept}    ${attrs}=${EMPTY}      ${context}=${EMPTY}    ${geoproperty}=${EMPTY}
    [Arguments]  ${id}     ${accept}    ${attrs}=${EMPTY}      ${context}=${EMPTY}    ${geoproperty}=${EMPTY}    ${options}=${EMPTY} 
    ${attrs_length} =  Get Length  ${attrs}
    ${options_length} =  Get Length  ${options}
    &{headers}=  Create Dictionary
    &{params}=  Create Dictionary
    Set To Dictionary   ${headers}   Accept    ${accept}
    Run Keyword If     '${context}'!=''       Set To Dictionary   ${headers}    Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept}
    Run Keyword If     ${attrs_length}>0       Set To Dictionary   ${params}       attrs=${attrs}
    Run Keyword If     '${geoproperty}'!=''       Set To Dictionary   ${params}    geoproperty=${geoproperty}
    Run Keyword If     ${options_length}>0       Set To Dictionary   ${params}       options=${options}
    ${response}=  GET  ${ENTITIES_ENDPOINT_PATH}${id}      headers=${headers}      query=${params}
    Output  request
    Output  response