Loading TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +5 −2 Changes for TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot: 5 added lines, 2 removed lines. Original line number Original line Diff line number Diff line Loading @@ -6,17 +6,20 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-simple-attributes-sample.jsonld ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld *** Test Cases *** *** Test Cases *** 001_01_Check that you can get an entity by id 001_01_Get an entity by id [Documentation] Check that you can get an entity by id [Documentation] Check that you can get an entity by id [Tags] mandatory [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} ${entity_id}= Generate Random Entity Id ${building_id_prefix} ${request} ${response}= Create Entity Selecting Content Type building-simple-attributes-sample.jsonld ${entity_id} application/ld+json ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} Check Response Status Code 201 ${response['status']} ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 200 ${response['status']} 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} [Teardown] Delete Entity by Id Returning Response ${entity_id} No newline at end of file TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot +28 Changes for TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot: 28 added lines, 0 removed lines. Original line number Original line Diff line number Diff line *** Settings *** Documentation Check that you can query some attributes from entity 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-query-attributes.jsonld ${attribute_airqualitylevel}= https://uri.fiware.org/ns/data-models#airQualityLevel ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory *** Test Cases *** 001_02_Query some attributes from an entity [Documentation] Check that you can query some attributes from entity [Tags] mandatory ${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']} ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} 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 data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld +17 Changes for data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld: 17 added lines, 0 removed lines. Original line number Original line Diff line number Diff line { "id": "urn:ngsi-ld:Building:7123416795055774", "type": "https://uri.fiware.org/ns/data-models#Building", "https://uri.fiware.org/ns/data-models#airQualityLevel": { "type": "Property", "value": 4, "observedAt": "2020-09-09T16:40:00.000Z", "unitCode": "C62" }, "https://uri.fiware.org/ns/data-models#subCategory": { "type": "Property", "value": "tourism" }, "@context": [ "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } No newline at end of file data/entities/expectations/building-simple-attributes-sample-expectation.jsonld +25 Changes for data/entities/expectations/building-simple-attributes-sample-expectation.jsonld: 25 added lines, 0 removed lines. Original line number Original line Diff line number Diff line { "id": "urn:ngsi-ld:Building:6539860708584325", "type": "https://uri.fiware.org/ns/data-models#Building", "name": { "type": "Property", "value": "Eiffel Tower" }, "https://uri.fiware.org/ns/data-models#airQualityLevel": { "type": "Property", "value": 4, "observedAt": "2020-09-09T16:40:00.000Z", "unitCode": "C62" }, "https://uri.fiware.org/ns/data-models#almostFull": { "type": "Property", "value": false }, "https://uri.fiware.org/ns/data-models#subCategory": { "type": "Property", "value": "tourism" }, "@context": [ "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } No newline at end of file resources/ApiUtils.resource +16 −4 Changes for resources/ApiUtils.resource: 16 added lines, 4 removed lines. Original line number Original line Diff line number Diff line Loading @@ -68,12 +68,26 @@ Retrieve Entity by Id Returning Response [Arguments] ${id} ${accept} ${context}=${EMPTY} [Arguments] ${id} ${accept} ${context}=${EMPTY} ${headers}= Create Dictionary ${headers}= Create Dictionary Set To Dictionary ${headers} Accept ${accept} 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="application/ld+json" Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} Output request Output request Output response Output response [return] ${response} [return] ${response} Query Entity [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${attrs_length} = Get Length ${attrs} &{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} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} Output request Output response [return] ${response} Retrieve Entity by Id Retrieve Entity by Id [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary ${headers}= Create Dictionary Loading @@ -88,12 +102,10 @@ Create Entity Selecting Content Type [Arguments] ${filename} ${entity_id} ${content_type} [Arguments] ${filename} ${entity_id} ${content_type} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} &{headers}= Create Dictionary Content-Type=${content_type} &{headers}= Create Dictionary Content-Type=${content_type} ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} Output request Output response ${request}= Output request ${request}= Output request Output response [return] ${request} ${response} [return] ${request} ${response} Create Entity Create Entity Loading Loading
TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +5 −2 Changes for TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot: 5 added lines, 2 removed lines. Original line number Original line Diff line number Diff line Loading @@ -6,17 +6,20 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-simple-attributes-sample.jsonld ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld *** Test Cases *** *** Test Cases *** 001_01_Check that you can get an entity by id 001_01_Get an entity by id [Documentation] Check that you can get an entity by id [Documentation] Check that you can get an entity by id [Tags] mandatory [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} ${entity_id}= Generate Random Entity Id ${building_id_prefix} ${request} ${response}= Create Entity Selecting Content Type building-simple-attributes-sample.jsonld ${entity_id} application/ld+json ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} Check Response Status Code 201 ${response['status']} ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 200 ${response['status']} 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} [Teardown] Delete Entity by Id Returning Response ${entity_id} No newline at end of file
TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot +28 Changes for TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot: 28 added lines, 0 removed lines. Original line number Original line Diff line number Diff line *** Settings *** Documentation Check that you can query some attributes from entity 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-query-attributes.jsonld ${attribute_airqualitylevel}= https://uri.fiware.org/ns/data-models#airQualityLevel ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory *** Test Cases *** 001_02_Query some attributes from an entity [Documentation] Check that you can query some attributes from entity [Tags] mandatory ${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']} ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} 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
data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld +17 Changes for data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld: 17 added lines, 0 removed lines. Original line number Original line Diff line number Diff line { "id": "urn:ngsi-ld:Building:7123416795055774", "type": "https://uri.fiware.org/ns/data-models#Building", "https://uri.fiware.org/ns/data-models#airQualityLevel": { "type": "Property", "value": 4, "observedAt": "2020-09-09T16:40:00.000Z", "unitCode": "C62" }, "https://uri.fiware.org/ns/data-models#subCategory": { "type": "Property", "value": "tourism" }, "@context": [ "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } No newline at end of file
data/entities/expectations/building-simple-attributes-sample-expectation.jsonld +25 Changes for data/entities/expectations/building-simple-attributes-sample-expectation.jsonld: 25 added lines, 0 removed lines. Original line number Original line Diff line number Diff line { "id": "urn:ngsi-ld:Building:6539860708584325", "type": "https://uri.fiware.org/ns/data-models#Building", "name": { "type": "Property", "value": "Eiffel Tower" }, "https://uri.fiware.org/ns/data-models#airQualityLevel": { "type": "Property", "value": 4, "observedAt": "2020-09-09T16:40:00.000Z", "unitCode": "C62" }, "https://uri.fiware.org/ns/data-models#almostFull": { "type": "Property", "value": false }, "https://uri.fiware.org/ns/data-models#subCategory": { "type": "Property", "value": "tourism" }, "@context": [ "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" ] } No newline at end of file
resources/ApiUtils.resource +16 −4 Changes for resources/ApiUtils.resource: 16 added lines, 4 removed lines. Original line number Original line Diff line number Diff line Loading @@ -68,12 +68,26 @@ Retrieve Entity by Id Returning Response [Arguments] ${id} ${accept} ${context}=${EMPTY} [Arguments] ${id} ${accept} ${context}=${EMPTY} ${headers}= Create Dictionary ${headers}= Create Dictionary Set To Dictionary ${headers} Accept ${accept} 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="application/ld+json" Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} Output request Output request Output response Output response [return] ${response} [return] ${response} Query Entity [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${attrs_length} = Get Length ${attrs} &{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} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} Output request Output response [return] ${response} Retrieve Entity by Id Retrieve Entity by Id [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary ${headers}= Create Dictionary Loading @@ -88,12 +102,10 @@ Create Entity Selecting Content Type [Arguments] ${filename} ${entity_id} ${content_type} [Arguments] ${filename} ${entity_id} ${content_type} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} &{headers}= Create Dictionary Content-Type=${content_type} &{headers}= Create Dictionary Content-Type=${content_type} ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} Output request Output response ${request}= Output request ${request}= Output request Output response [return] ${request} ${response} [return] ${request} ${response} Create Entity Create Entity Loading