From 8ac0aa50f4c6f217a36686fe89ecf492edd26d0e Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 11 Dec 2020 09:35:57 +0100 Subject: [PATCH 1/4] feat: add JSON-LD @context resolution tests for batch entity creation endpoint --- .../CreateBatchOfEntities/003_04.robot | 32 +++++++++++++++++++ .../CreateBatchOfEntities/003_05.robot | 32 +++++++++++++++++++ .../CreateBatchOfEntities/003_06.robot | 23 +++++++++++++ .../CreateBatchOfEntities/003_07.robot | 32 +++++++++++++++++++ .../CreateBatchOfEntities/003_08.robot | 23 +++++++++++++ .../CreateBatchOfEntities/003_09.robot | 23 +++++++++++++ data/entities/building-simple-attributes.json | 22 +++++++++++++ resources/ApiUtils.resource | 24 ++++++++++++-- resources/AssertionUtils.resource | 12 +++++-- 9 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot create mode 100644 data/entities/building-simple-attributes.json diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot new file mode 100644 index 00000000..7b5824b8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity using a provided Link header with JSON content type + [Documentation] Check that the @context is obtained from a Link Header if the Content-Type header is "application/json" + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 201 + + Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to almostFull + + Retrieve Entity by Id ${entity_id} + # Attribute should not be compacted as we did not provide a context containing this attribute + Check Response Body Containing an Attribute set to https://ngsi-ld-test-suite/context#almostFull + + @{entities_ids_to_be_deleted}= Create List ${entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot new file mode 100644 index 00000000..76a69b53 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity using the default context with JSON content type + [Documentation] Check that the default @context is used if the Content-Type header is "application/json" and the Link header does not contain a JSON-LD @context + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 201 + + Retrieve Entity by Id ${entity_id} + # Attribute should be compacted as we used the same default context as provided when creating the entity + Check Response Body Containing an Attribute set to almostFull + + Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to https://uri.etsi.org/ngsi-ld/default-context/almostFull + + @{entities_ids_to_be_deleted}= Create List ${entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot new file mode 100644 index 00000000..eb4a857e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity containing a JSON-LD @context with a JSON content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/json" and the request payload body (as JSON) contains a "@context" term + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 400 + Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing Problem Details Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot new file mode 100644 index 00000000..da87b151 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity using a JSON-LD @context obtained from the request payload + [Documentation] Check that the @context is obtained from the request payload body itself if the Content-Type header is "application/ld+json" + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.jsonld ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + + Check Response Status Code Set To 201 + + Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} + # Attribute should be compacted as we used the same context as provided when creating the entity + Check Response Body Containing an Attribute set to almostFull + + Retrieve Entity by Id ${entity_id} + # Attribute should not be compacted as we did not provide a context containing this term + Check Response Body Containing an Attribute set to https://ngsi-ld-test-suite/context#almostFull + + @{entities_ids_to_be_deleted}= Create List ${entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot new file mode 100644 index 00000000..8c491aa6 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity not containing a JSON-LD @context with a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and the request payload body does not contain a @context term + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} + + Check Response Status Code Set To 400 + Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing Problem Details Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot new file mode 100644 index 00000000..f0519d2f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Case *** +Create a batch of one entity with a Link header and a JSON-LD content type + [Documentation] Check that an HTTP error response of type BadRequestData is raised if the Content-Type header is "application/ld+json" and a JSON-LD Link header is present in the incoming HTTP request + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${entity}= Load Entity building-simple-attributes.json ${entity_id} + @{entities_to_be_created}= Create List ${entity} + + Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 400 + Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing Problem Details Element Containing Title Element ${response} diff --git a/data/entities/building-simple-attributes.json b/data/entities/building-simple-attributes.json new file mode 100644 index 00000000..c0beff52 --- /dev/null +++ b/data/entities/building-simple-attributes.json @@ -0,0 +1,22 @@ +{ + "id": "RandomUuidToBeReplaced", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": ["tourism"] + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + } +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 547834a9..946c63e4 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -11,10 +11,16 @@ ${BATCH_CREATE_ENDPOINT_PATH} entityOperations/create ${BATCH_UPSERT_ENDPOINT_PATH} entityOperations/upsert ${BATCH_UPDATE_ENDPOINT_PATH} entityOperations/update ${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete +&{BATCH_OPERATION_ENDPOINT_MAPPING} create=${BATCH_CREATE_ENDPOINT_PATH} upsert=${BATCH_UPSERT_ENDPOINT_PATH} update=${BATCH_UPDATE_ENDPOINT_PATH} delete=${BATCH_DELETE_ENDPOINT_PATH} ${ENTITIES_ENDPOINT_PATH} entities ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities + +${CONTENT_TYPE_JSON} application/json +${CONTENT_TYPE_LD_JSON} application/ld+json + +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData + ${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} *** Keywords *** Api POST request @@ -47,6 +53,16 @@ Delete Entity by Id Output request Output response +Retrieve Entity by Id + [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} + ${headers}= 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="application/ld+json" + ${response}= GET ${ENTITIES_ENDPOINT_PATH}/${id} headers=${headers} + Output request + Output response + Set Test Variable ${response} + Create Entity [Arguments] ${filename} ${entity_id} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} @@ -58,8 +74,10 @@ Create Entity Output response Batch Create Entities - [Arguments] @{entities_to_be_created} - &{headers}= Create Dictionary Content-Type=application/ld+json + [Arguments] @{entities_to_be_created} ${content_type}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} + ${headers}= Create Dictionary + Set To Dictionary ${headers} Content-Type ${content_type} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= POST ${BATCH_CREATE_ENDPOINT_PATH} body=@{entities_to_be_created} headers=${headers} Output request Output response diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index c27409d5..0792c52b 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -18,6 +18,10 @@ Check Response Body Containing Array Of URIs set to [Arguments] @{expected_entities_ids} Lists Should Be Equal ${expected_entities_ids} ${response['body']} ignore_order=True +Check Response Body Containing an Attribute set to + [Arguments] @{expected_attribute_name} + Should Not Be Empty ${response['body']['${expected_attribute_name[0]}']} + Check Response Body Containing Batch Operation Result [Arguments] ${expected_batch_operation_result} @{expected_successful_entities_ids}= Get From Dictionary ${expected_batch_operation_result} success @@ -41,9 +45,13 @@ Check Response Body Containing EntityTemporal element ${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 +Check Response Body Containing Problem Details Element Containing Type Element + [Arguments] ${response_body} ${type} + Should Be Equal ${response['body']['type']} ${type} + +Check Response Body Containing Problem Details Element Containing Title Element [Arguments] ${response_body} - Should Not Be Empty ${response_body['detail']} + Should Not Be Empty ${response['body']['detail']} Check RL Response Body Containing Problem Details Element Containing Detail Element [Arguments] ${response_body} -- GitLab From 387d973709bc2898b7dbb25833252ce653d5c564 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 14 Dec 2020 12:34:49 +0100 Subject: [PATCH 2/4] fix: update name of fixture data to use the -sample prefix in filename --- .../Provision/BatchEntities/CreateBatchOfEntities/003_04.robot | 2 +- .../Provision/BatchEntities/CreateBatchOfEntities/003_05.robot | 2 +- .../Provision/BatchEntities/CreateBatchOfEntities/003_06.robot | 2 +- .../Provision/BatchEntities/CreateBatchOfEntities/003_07.robot | 2 +- .../Provision/BatchEntities/CreateBatchOfEntities/003_08.robot | 2 +- .../Provision/BatchEntities/CreateBatchOfEntities/003_09.robot | 2 +- ...e-attributes.json => building-simple-attributes-sample.json} | 0 7 files changed, 6 insertions(+), 6 deletions(-) rename data/entities/{building-simple-attributes.json => building-simple-attributes-sample.json} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot index 7b5824b8..484baea7 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_04.robot @@ -13,7 +13,7 @@ Create a batch of one entity using a provided Link header with JSON content type [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.json ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot index 76a69b53..9a489158 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot @@ -13,7 +13,7 @@ Create a batch of one entity using the default context with JSON content type [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.json ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot index eb4a857e..573f3d07 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -13,7 +13,7 @@ Create a batch of one entity containing a JSON-LD @context with a JSON content t [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.jsonld ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot index da87b151..89d4cfde 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_07.robot @@ -13,7 +13,7 @@ Create a batch of one entity using a JSON-LD @context obtained from the request [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.jsonld ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot index 8c491aa6..60ff8063 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -13,7 +13,7 @@ Create a batch of one entity not containing a JSON-LD @context with a JSON-LD co [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.json ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.json ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot index f0519d2f..7336cb19 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot @@ -13,7 +13,7 @@ Create a batch of one entity with a Link header and a JSON-LD content type [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${entity}= Load Entity building-simple-attributes.json ${entity_id} + ${entity}= Load Entity building-simple-attributes-sample.jsonld ${entity_id} @{entities_to_be_created}= Create List ${entity} Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} diff --git a/data/entities/building-simple-attributes.json b/data/entities/building-simple-attributes-sample.json similarity index 100% rename from data/entities/building-simple-attributes.json rename to data/entities/building-simple-attributes-sample.json -- GitLab From 457b00ac59d192142574735e7d3e87cb986c964b Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 14 Dec 2020 12:39:52 +0100 Subject: [PATCH 3/4] fix: use single argument when a list is not expected --- resources/AssertionUtils.resource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 0792c52b..91f75a2a 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -19,8 +19,8 @@ Check Response Body Containing Array Of URIs set to Lists Should Be Equal ${expected_entities_ids} ${response['body']} ignore_order=True Check Response Body Containing an Attribute set to - [Arguments] @{expected_attribute_name} - Should Not Be Empty ${response['body']['${expected_attribute_name[0]}']} + [Arguments] ${expected_attribute_name} + Should Not Be Empty ${response['body']['${expected_attribute_name}']} Check Response Body Containing Batch Operation Result [Arguments] ${expected_batch_operation_result} -- GitLab From 17e056d7708c61f3c4fa7d4c5bcfa15306e8f085 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 14 Dec 2020 16:27:55 +0100 Subject: [PATCH 4/4] fix: typo in check of title in ProblemDetails and use ProblemDetails for better understanding --- .../BatchEntities/CreateBatchOfEntities/003_03.robot | 2 +- .../BatchEntities/CreateBatchOfEntities/003_06.robot | 4 ++-- .../BatchEntities/CreateBatchOfEntities/003_08.robot | 4 ++-- .../BatchEntities/CreateBatchOfEntities/003_09.robot | 4 ++-- .../BatchEntities/DeleteBatchOfEntities/006_03.robot | 2 +- .../BatchEntities/UpdateBatchOfEntities/005_04.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/004_06.robot | 2 +- resources/AssertionUtils.resource | 8 ++++---- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot index 916fcd5c..81a0f4ad 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_03.robot @@ -18,4 +18,4 @@ Create Batch Entity With Invalid Request Scenarios Batch Request Entities From File create filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Body Containing ProblemDetails Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot index 573f3d07..b67ba32e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -19,5 +19,5 @@ Create a batch of one entity containing a JSON-LD @context with a JSON content t Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_JSON} Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} - Check Response Body Containing Problem Details Element Containing Title Element ${response} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot index 60ff8063..7646496a 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -19,5 +19,5 @@ Create a batch of one entity not containing a JSON-LD @context with a JSON-LD co Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} - Check Response Body Containing Problem Details Element Containing Title Element ${response} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot index 7336cb19..88ebf3ac 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_09.robot @@ -19,5 +19,5 @@ Create a batch of one entity with a Link header and a JSON-LD content type Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} Check Response Status Code Set To 400 - Check Response Body Containing Problem Details Element Containing Type Element ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} - Check Response Body Containing Problem Details Element Containing Title Element ${response} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot index ae664944..d3a32f42 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_03.robot @@ -18,4 +18,4 @@ Batch Delete Entity With Invalid Request Scenarios Batch Request Entities From File delete filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Body Containing ProblemDetails Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot index 2c7b8fd1..f9a32ae5 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_04.robot @@ -18,4 +18,4 @@ Batch Update Entity With Invalid Request Scenarios Batch Request Entities From File update filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Body Containing ProblemDetails Element Containing Detail Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot index aae23c28..d3a02b9c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -18,4 +18,4 @@ Batch Upsert Entity With Invalid Request Scenarios Batch Request Entities From File upsert filename=${filename} Check RL Response Status Code Set To 400 - Check RL Response Body Containing Problem Details Element Containing Detail Element ${response} + Check RL Response Body Containing ProblemDetails Element Containing Detail Element ${response} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 91f75a2a..6ed5b677 100644 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -45,15 +45,15 @@ Check Response Body Containing EntityTemporal element ${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 Type Element +Check Response Body Containing ProblemDetails Element Containing Type Element set to [Arguments] ${response_body} ${type} Should Be Equal ${response['body']['type']} ${type} -Check Response Body Containing Problem Details Element Containing Title Element +Check Response Body Containing ProblemDetails Element Containing Title Element [Arguments] ${response_body} - Should Not Be Empty ${response['body']['detail']} + Should Not Be Empty ${response['body']['title']} -Check RL Response Body Containing Problem Details Element Containing Detail Element +Check RL Response Body Containing ProblemDetails Element Containing Detail Element [Arguments] ${response_body} ${json_response_body}= To Json ${response_body.content} Should Not Be Empty ${json_response_body['detail']} -- GitLab