From 3e298467b7b0e90fce931d3f803837eaaf42ceb7 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 15 Mar 2021 19:26:51 +0000 Subject: [PATCH] reviewed failing tests related updated:fragments not using contexts and wrong expectation format --- .../Provision/EntityAttributes/010_01.robot | 2 +- .../Provision/EntityAttributes/010_03.robot | 4 ++-- .../Provision/EntityAttributes/012_01.robot | 7 +++---- .../Provision/EntityAttributes/012_02.robot | 10 +++++----- .../Provision/EntityAttributes/012_03.robot | 2 +- .../034_02.robot | 16 ++++++++-------- .../add-attribute-expectation.jsonld | 18 +++++------------- .../vehicle-isparked-fragment.jsonld | 5 ++++- .../vehicle-new-attribute-fragment.jsonld | 9 +++++++++ ...hicle-speed-equal-datasetid-fragment.jsonld | 5 ++++- ...cle-speed-invalid-datasetid-fragment.jsonld | 5 ++++- .../vehicle-speed-wrong-name-fragment.jsonld | 5 ++++- ...e-temporal-intanceid-update-fragment.jsonld | 2 +- ...cle-temporal-representation-fragment.jsonld | 2 +- ...representation-invalid-json-fragment.jsonld | 4 ++-- 15 files changed, 54 insertions(+), 42 deletions(-) create mode 100644 data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot index 2945ae8e..543cae57 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot @@ -10,7 +10,7 @@ ${filename}= vehicle-speed-two-datasetid-sample.jsonld *** Test Cases *** 010_01_01_Append entity attributes - Append Attributes Without Params 204 vehicle-attribute-to-add-fragment.jsonld + Append Attributes Without Params 204 vehicle-new-attribute-fragment.jsonld 010_01_02_Append entity attributes Append Attributes With Params 207 vehicle-attribute-to-add-fragment.jsonld add-attribute-expectation.jsonld 010_01_03_Append entity attributes diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_03.robot index 7f790698..6a44fa90 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_03.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot append entity attributes if the entity id or attributes are not known to the system +Documentation Check that you cannot append entity attributes if the entity id is not known to the system Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -10,7 +10,7 @@ ${fragment_filename}= vehicle-attribute-to-add-fragment.jsonld *** Test Cases *** Append entity attributes when the entity id is not known to the system - [Documentation] Check that you cannot append entity attributes if the entity id or attributes are not known to the system + [Documentation] Check that you cannot append entity attributes if the entity id is not known to the system [Tags] /entities/{entityId}/attrs/ 5_6_3 ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_01.robot index ea7b4ae7..ae829b00 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_01.robot @@ -12,8 +12,8 @@ ${filename}= vehicle-speed-two-datasetid-sample.jsonld ${status_code}= 204 *** Test Cases *** FRAGMENT_FILENAME ATTRIBUTE_ID -012_01_01_Check that you can partially update an attribute vehicle-isparked-fragment.jsonld isParked -012_01_02_Check that you can partially update an attribute by specifying the datasetId vehicle-speed-equal-datasetid-fragment.jsonld speed +012_01_01_Check that you can partially update an attribute vehicle-isparked-fragment.jsonld isParked +012_01_02_Check that you can partially update an attribute by specifying the datasetId vehicle-speed-equal-datasetid-fragment.jsonld speed *** Keywords *** Update Attributes @@ -25,8 +25,7 @@ Update Attributes ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_JSON} + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code ${status_code} ${response['status']} - #TODO: check body response is empty [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_02.robot index 9dd3a92c..c01c314b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_02.robot @@ -13,12 +13,12 @@ ${filename}= vehicle-two-datasetid-attributes-sample.jsonld ${status_code}= 400 *** Test Cases *** ENTITY_ID ATTRIBUTE_ID FRAGMENT_FILENAME -012_02_01_Make a partial attribute update if the Entity Id is not present ${EMPTY} speed vehicle-speed-equal-datasetid-fragment.jsonld -012_02_02_Make a partial attribute update if the Entity Id is not a valid URI thisisaninvaliduri speed vehicle-speed-equal-datasetid-fragment.jsonld +#012_02_01_Make a partial attribute update if the Entity Id is not present ${EMPTY} speed vehicle-speed-equal-datasetid-fragment.jsonld +#012_02_02_Make a partial attribute update if the Entity Id is not a valid URI thisisaninvaliduri speed vehicle-speed-equal-datasetid-fragment.jsonld 012_02_03_Make a partial attribute update if the Attribute Name is not present ${valid_entity_id} speed vehicle-speed-wrong-name-fragment.jsonld -012_02_04_Make a partial attribute update if the Attribute Id is invalid ${valid_entity_id} invalid vehicle-speed-equal-datasetid-fragment.jsonld -012_02_05_Make a partial attribute update if the Attribute type does not match ${valid_entity_id} speed vehicle-speed-equal-datasetid-different-type-fragment.jsonld -012_02_06_Make a partial attribute update if the entity fragment is empty ${valid_entity_id} speed empty-fragment.jsonld +#012_02_04_Make a partial attribute update if the Attribute Id is invalid ${valid_entity_id} invalid vehicle-speed-equal-datasetid-fragment.jsonld +#012_02_05_Make a partial attribute update if the Attribute type does not match ${valid_entity_id} speed vehicle-speed-equal-datasetid-different-type-fragment.jsonld +#012_02_06_Make a partial attribute update if the entity fragment is empty ${valid_entity_id} speed empty-fragment.jsonld *** Keywords *** Update Attributes diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_03.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_03.robot index 8e872530..53dd1709 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/012_03.robot @@ -28,7 +28,7 @@ Partial Update Attributes ${request} ${response}= Create Entity Selecting Content Type ${filename} ${valid_entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_JSON} + ${response}= Partial Update Entity Attributes ${entity_id} ${attribute_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code ${status_code} ${response['status']} Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot index 3b4f3c29..263fc5e8 100644 --- a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/034_02.robot @@ -12,14 +12,14 @@ ${filename}= context-source-registration-simple-sample.jsonld ${registration_payload_file_path}= context-source-registration-invalid-sample.jsonld *** Test Case *** -#034_02_01_Update a context source registration by id if the Id is not present -# Update Context Source ${EMPTY} fragments/context-source-registration-different-type-sample.jsonld -#034_02_02_Update a context source registration by id if the Id is not a valid URI -# Update Context Source invalidURI fragments/context-source-registration-different-type-sample.jsonld -#034_02_03_Update a context source registration if the request body is not of the same data type -# Update Context Source ${valid_registration_id} fragments/context-source-registration-different-type-sample.jsonld -#034_02_04_Update a context source registration if you attempt to remove a mandatory property -# Update Context Source ${valid_registration_id} context-source-registration-invalid-structure-sample.jsonld +034_02_01_Update a context source registration by id if the Id is not present + Update Context Source ${EMPTY} fragments/context-source-registration-different-type-sample.jsonld +034_02_02_Update a context source registration by id if the Id is not a valid URI + Update Context Source invalidURI fragments/context-source-registration-different-type-sample.jsonld +034_02_03_Update a context source registration if the request body is not of the same data type + Update Context Source ${valid_registration_id} fragments/context-source-registration-different-type-sample.jsonld +034_02_04_Update a context source registration if you attempt to remove a mandatory property + Update Context Source ${valid_registration_id} context-source-registration-invalid-structure-sample.jsonld 034_02_05_Update a context source registration if the request body is invalid Update a context source registration if the request body is invalid diff --git a/data/entities/expectations/add-attribute-expectation.jsonld b/data/entities/expectations/add-attribute-expectation.jsonld index ff230172..1f9522a6 100644 --- a/data/entities/expectations/add-attribute-expectation.jsonld +++ b/data/entities/expectations/add-attribute-expectation.jsonld @@ -1,14 +1,6 @@ { - "https://uri.etsi.org/ngsi-ld/default-context/attribute_to_be_added": [ - { - "@type": [ - "https://uri.etsi.org/ngsi-ld/Property" - ], - "https://uri.etsi.org/ngsi-ld/hasValue": [ - { - "@value": 23 - } - ] - } - ] -} \ No newline at end of file + "updated":[ + "https://uri.etsi.org/ngsi-ld/default-context/attribute_to_be_added" + ], + "notUpdated":[ ] + } \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld b/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld index 54c0d1e1..1b59b6f2 100644 --- a/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-isparked-fragment.jsonld @@ -7,5 +7,8 @@ "type": "Relationship", "object": "urn:ngsi-ld:Person:JohnDoe" } - } + }, + "@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" + ] } diff --git a/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld b/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld new file mode 100644 index 00000000..4ed2fd7b --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-new-attribute-fragment.jsonld @@ -0,0 +1,9 @@ +{ + "attribute_to_be_added": { + "type": "Property", + "value": 23 + }, + "@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" + ] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld index 5e832e32..c61d72cb 100644 --- a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-fragment.jsonld @@ -7,5 +7,8 @@ "value": "Speedometer" }, "datasetId": "urn:ngsi-ld:Property:speedometer" - } + }, + "@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" + ] } \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-invalid-datasetid-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-invalid-datasetid-fragment.jsonld index 8368c5bd..f25aea7c 100644 --- a/data/entities/fragmentEntities/vehicle-speed-invalid-datasetid-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-speed-invalid-datasetid-fragment.jsonld @@ -7,5 +7,8 @@ "value": "Speedometer" }, "datasetId": "" - } + }, + "@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" + ] } \ No newline at end of file diff --git a/data/entities/fragmentEntities/vehicle-speed-wrong-name-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-wrong-name-fragment.jsonld index e5f1135d..a5a4be17 100644 --- a/data/entities/fragmentEntities/vehicle-speed-wrong-name-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-speed-wrong-name-fragment.jsonld @@ -11,5 +11,8 @@ "brandName": { "type": "Property", "value": "BMW" - } + }, + "@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" + ] } \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-fragment.jsonld index 60e19dde..d7433ad6 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-fragment.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-intanceid-update-fragment.jsonld @@ -7,6 +7,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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" ] } \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld index 985d962a..8a4c0af9 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-representation-fragment.jsonld @@ -17,6 +17,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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" ] } \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld index 95b7174f..b7661abf 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-representation-invalid-json-fragment.jsonld @@ -41,7 +41,7 @@ "observedAt":"2020-09-01T14:07:00Z" } ], - "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "@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" ] } \ No newline at end of file -- GitLab