diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..9bbe02f2505524f4d5349ffbcedf98598beb343b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_01.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-01-expectation.jsonld + +*** Test Case *** +Retrieve the temporal evolution of an entity + [Documentation] Check that you can retrieve the temporal evolution of an entity + [Tags] mandatory + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..8031817d1eff275ad6db468fd5a08e627af0d7a9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_02.robot @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity using a context +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-02-expectation.jsonld + +*** Test Case *** +Retrieve the temporal evolution of an entity using a context + [Documentation] Check that you can retrieve the temporal evolution of an entity using a context + [Tags] mandatory + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..47e1f163ca8eced7c66bfde67e1d35c9950194f5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_03.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of certain attributes of an entity +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-03-expectation.jsonld + +*** Test Case *** +Retrieve the temporal evolution of certain attributes of an entity + [Documentation] Check that you can retrieve the temporal evolution of certain attributes of an entity + [Tags] mandatory + + @{temporal_attributes_to_be_retrieved}= Create List fuelLevel + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} attrs=${temporal_attributes_to_be_retrieved} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..5640f0720877e77ee16a6277680ab3e2b1cf902a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_04.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Test Template Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld + +*** Test Cases *** TIMEREL TIME ENDTIME VEHICLE_EXPECTATION_FILE +After after 2018-08-01T13:03:00Z ${EMPTY} vehicle-temporal-representation-020-04-01-expectation.jsonld +Before before 2018-08-01T12:05:00Z ${EMPTY} vehicle-temporal-representation-020-04-02-expectation.jsonld +Between between 2018-08-01T12:00:00Z 2018-08-01T13:00:00Z vehicle-temporal-representation-020-04-03-expectation.jsonld + +*** Keywords *** +Retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + [Arguments] ${timerel} ${time} ${endTime} ${vehicle_expectation_file} + [Documentation] Check that you can retrieve the temporal evolution of an entity matching the given NGSI-LD temporal query + [Tags] mandatory + + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} timerel=${timerel} time=${time} endTime=${endTime} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} + +#TODO Call Suite Teardown \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..4c8f62bda5ce0e21a3db5f7645c677066f550fa2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_10.robot @@ -0,0 +1,31 @@ +*** Settings *** +Documentation Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities + +*** Variable *** +${vehicule_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicule-temporal-representation-sample.jsonld +${vehicle_expectation_file}= vehicle-temporal-representation-020-10-expectation.jsonld + +*** Test Case *** +Retrieve the temporal evolution of an entity with the simplified temporal representation + [Documentation] Check that you can retrieve the temporal evolution of an entity with the simplified temporal representation + [Tags] mandatory + + @{options}= Create List temporalValues + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} options=${options} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing EntityTemporal element ${vehicle_expectation_file} ${temporal_entity_representation_id} + + #TODO Call Delete Temporal Representation Of Entity + +*** Keywords *** +Setup Initial Entities + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicule_id_prefix} + Create Temporal Representation Of Entity ${vehicle_payload_file} ${temporal_entity_representation_id} + Set Suite Variable ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..3671ae37b5371f4c765a29cccb14b75c22fad6c7 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-01-expectation.jsonld @@ -0,0 +1,43 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "https://ngsi-ld-test-suite/context#brandName":{ + "type":"Property", + "value":"Volvo" + }, + "https://ngsi-ld-test-suite/context#speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + } + ], + "https://ngsi-ld-test-suite/context#fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ca4ca6ede0ce97ad985626fc094e0a4d4cce5bb8 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-02-expectation.jsonld @@ -0,0 +1,43 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..facf8b67db6ba8ad242dc776312b703b133bfd91 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-03-expectation.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..32bf63c03e5f014198ea0c9769a4a6ef6a24b12a --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-01-expectation.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":[ + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..af46993ba27c4df25a8b7b446888b52318b49ee4 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-02-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":{ + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8c87d29e3503ab96e24110f7ba1e49c3bcd995a6 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-04-03-expectation.jsonld @@ -0,0 +1,30 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":{ + "type":"Property", + "value":"Volvo" + }, + "fuelLevel":{ + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + } + ] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..6ed056e18f586e26f076f2c7d1c1981bb71ead39 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-020-10-expectation.jsonld @@ -0,0 +1,15 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName": "Volvo", + "speed":[ + [ 120, "2018-08-01T12:03:00Z" ], + [ 80, "2018-08-01T12:05:00Z" ], + [ 100, "2018-08-01T12:07:00Z" ] + ], + "fuelLevel":[ + [ 67, "2018-08-01T12:03:00Z" ], + [ 53, "2018-08-01T13:05:00Z" ], + [ 40, "2018-08-01T14:07:00Z" ] + ] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicule-temporal-representation-sample.jsonld b/data/temporalEntities/vehicule-temporal-representation-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..3423d17c24401ba7ee8914934f39aa5a1e054a43 --- /dev/null +++ b/data/temporalEntities/vehicule-temporal-representation-sample.jsonld @@ -0,0 +1,48 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "brandName":[ + { + "type":"Property", + "value":"Volvo" + } + ], + "speed":[ + { + "type":"Property", + "value":120, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":80, + "observedAt":"2018-08-01T12:05:00Z" + }, + { + "type":"Property", + "value":100, + "observedAt":"2018-08-01T12:07:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2018-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2018-08-01T13:05:00Z" + }, + { + "type":"Property", + "value":40, + "observedAt":"2018-08-01T14:07:00Z" + } + ], + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/libraries/assertionUtils.py b/libraries/assertionUtils.py new file mode 100644 index 0000000000000000000000000000000000000000..87a56863b6d7e5ee42c8434754027d284a094dc2 --- /dev/null +++ b/libraries/assertionUtils.py @@ -0,0 +1,11 @@ +from deepdiff import DeepDiff + +def compare_dictionaries_ignoring_keys(dict1, dict2, exclude_regex_paths): + """Function exposed as a keyword to compare two dictionaries + :param dict1: actual dictionary + :param dict2: expected dictionary + :param exclude_regex_paths: regex path of keys to be ignored + """ + res = DeepDiff(dict1, dict2, exclude_regex_paths=[exclude_regex_paths], ignore_order=True) + print(res) + return not res diff --git a/requirements.txt b/requirements.txt index 6a311f15a15cf307198a724dcc4507ba46ef8e90..c82d168170dfb4b7c01b7abe1debf9d227a4c8a7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,4 +2,5 @@ robotframework==3.2.1 RESTinstance==1.0.2 robotframework-jsonschemalibrary==1.0 robotframework-jsonlibrary==0.3.1 -robotframework-requests==0.7.0 \ No newline at end of file +robotframework-requests==0.7.0 +deepdiff==5.0.2 diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 934ca4a43fbef5ec31f8d2f648aa56d9733a4fa8..547834a9f07ccbb2adcdcfb7b8b7850be96a85d3 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -12,6 +12,7 @@ ${BATCH_UPSERT_ENDPOINT_PATH} entityOperations/upsert ${BATCH_UPDATE_ENDPOINT_PATH} entityOperations/update ${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete ${ENTITIES_ENDPOINT_PATH} entities +${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities ${response} &{BATCH_OPERATION_ENDPOINT_MAPPING} create=${BATCH_CREATE_ENDPOINT_PATH} upsert=${BATCH_UPSERT_ENDPOINT_PATH} update=${BATCH_UPDATE_ENDPOINT_PATH} delete=${BATCH_DELETE_ENDPOINT_PATH} @@ -96,3 +97,32 @@ Batch Request Entities From File &{headers}= Create Dictionary Content-Type=application/ld+json ${response}= POST Request BatchRequest ${endpoint_url} data=${file_content} headers=${headers} Set Test Variable ${response} + +Create Temporal Representation Of Entity + [Arguments] ${filename} ${temporal_entity_representation_id} + ${temporal_entity_representation_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/${filename} + ${temporal_entity_representation}= Update Value To Json ${temporal_entity_representation_payload} $..id ${temporal_entity_representation_id} + + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST ${TEMPORAL_ENTITIES_ENDPOINT_PATH} body=${temporal_entity_representation} headers=${headers} + Output request + Output response + +Retrieve Temporal Representation Of Entity + [Arguments] ${temporal_entity_representation_id} ${attrs}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${timerel}=${EMPTY} ${time}=${EMPTY} ${endTime}=${EMPTY} + ${attrs_length} = Get Length ${attrs} + ${options_length} = Get Length ${options} + &{headers}= Create Dictionary + &{params}= Create Dictionary + + 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 ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} + Run Keyword If '${timerel}'!='' Set To Dictionary ${params} timerel=${timerel} + Run Keyword If '${time}'!='' Set To Dictionary ${params} time=${time} + Run Keyword If '${endTime}'!='' Set To Dictionary ${params} endTime=${endTime} + + ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} + Output request + Output response + Set Test Variable ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 324d81824ebe5f7feadf29fbee72e330c8787939..c27409d5a59d978a9b3b3fc6c9ee299643ad137c 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -1,3 +1,9 @@ +*** Settings *** +Library ${EXECDIR}/libraries/assertionUtils.py + +*** Variable *** +${instance_id_regex_expr}= root\\[.*\\]\\['instanceId'\\] + *** Keywords *** Check Response Status Code Set To [Arguments] ${expected_status} @@ -28,6 +34,13 @@ Check Response Body Containing Batch Operation Result Should Not Be Empty ${response_error['error']} END +Check Response Body Containing EntityTemporal element + [Arguments] ${filename} ${temporal_entity_representation_id} + ${temporal_entity_representation_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/expectations/${filename} + ${temporal_entity_representation}= Update Value To Json ${temporal_entity_representation_payload} $..id ${temporal_entity_representation_id} + ${comparaison_result}= Compare Dictionaries Ignoring Keys ${response['body']} ${temporal_entity_representation} ${instance_id_regex_expr} + Should Be True ${comparaison_result} msg=EntityTemporal Comparaison Failed + Check Response Body Containing Problem Details Element Containing Detail Element [Arguments] ${response_body} Should Not Be Empty ${response_body['detail']} diff --git a/resources/ngsi-ld-test-suite-context.jsonld b/resources/ngsi-ld-test-suite-context.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..b9f67ea25c3054f7029591ad04aae0f46b9f26ca --- /dev/null +++ b/resources/ngsi-ld-test-suite-context.jsonld @@ -0,0 +1,7 @@ +{ + "@context":{ + "brandName":"https://ngsi-ld-test-suite/context#brandName", + "speed":"https://ngsi-ld-test-suite/context#speed", + "fuelLevel":"https://ngsi-ld-test-suite/context#fuelLevel" + } +} \ No newline at end of file diff --git a/resources/variables.py b/resources/variables.py index 7136ce1fd444d79487aae2ef7ed07874c78069b1..1917f8e89d7fb7d86468fe19bd7a0e674cab5fad 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -1,5 +1,6 @@ def get_variables(arg=None): variables = { - 'url': 'http://127.0.0.1:8082/ngsi-ld/v1' + 'url': 'http://10.5.1.214:9090/ngsi-ld/v1', + 'ngsild_test_suite_context': 'https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld' } return variables