From 50bc87534dbb84257106eb37d23ff231d6476c37 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 2 Dec 2020 14:18:10 +0100 Subject: [PATCH 1/2] fix: call Batch Delete Entities in test teardown --- .../CreateBatchOfEntities/fullSuccess.robot | 13 ++++--------- .../CreateBatchOfEntities/partialSuccess.robot | 10 ++++------ .../DeleteBatchOfEntities/fullSuccess.robot | 2 +- .../DeleteBatchOfEntities/partialSuccess.robot | 2 +- .../UpdateBatchOfEntities/fullSuccess.robot | 6 +++--- .../fullSuccessNoOverwriteMode.robot | 6 +++--- .../UpdateBatchOfEntities/partialSuccess.robot | 5 ++--- .../fullSuccessReplaceMode.robot | 11 ++++------- .../fullSuccessReplaceModeAllUpdated.robot | 6 +++--- .../fullSuccessUpdateMode.robot | 6 +++--- .../UpsertBatchOfEntities/partialSucess.robot | 5 ++--- resources/ApiUtils.resource | 2 +- 12 files changed, 31 insertions(+), 43 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot index 4f678cb5..56bda491 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/fullSuccess.robot @@ -11,6 +11,7 @@ Library Collections *** Variable *** ${batch_endpoint}= entityOperations/create +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -31,9 +32,7 @@ Create a batch of minimal entities Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + Batch Delete Entities @{expected_entities_ids} Create a batch of entities having only simple properties [Documentation] Check that you can create a batch of entities having only simple properties @@ -51,9 +50,7 @@ Create a batch of entities having only simple properties Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + Batch Delete Entities @{expected_entities_ids} Create a batch of entities having multiple attributes [Documentation] Check that you can create a batch of entities having multiple attributes @@ -71,6 +68,4 @@ Create a batch of entities having multiple attributes Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + Batch Delete Entities @{expected_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index db0fef64..3c92d668 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/create +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -36,14 +37,11 @@ Create a batch of two valid entities and one invalid entity Check Response Status Code Set To 207 Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} - Delete Entity by Id ${existing_entity_id} - + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} + *** Keywords *** Setup Initial Entities ${existing_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity building-minimal-sample.jsonld ${existing_entity_id} Set Suite Variable ${existing_entity_id} - diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot index 3e5883f3..09049cb3 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/fullSuccess.robot @@ -12,7 +12,7 @@ Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/delete +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot index 5fda7423..ea7152e9 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/partialSuccess.robot @@ -12,7 +12,7 @@ Library Collections Suite Setup Setup Initial Entities *** Variable *** -${batch_endpoint}= entityOperations/delete +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot index 19254c4c..88425216 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccess.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/update +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -29,9 +30,8 @@ Update a batch of entities Check Response Status Code Set To 204 - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot index 27d8601d..e6c44a31 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/fullSuccessNoOverwriteMode.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/update +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -29,9 +30,8 @@ Update a batch of entities with noOverwrite option Check Response Status Code Set To 204 - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot index 8e20824b..79c8a17b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/partialSuccess.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/update +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -37,9 +38,7 @@ Update a batch of non existing and existing entities Check Response Status Code Set To 207 Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_existing_entity_id} - Delete Entity by Id ${second_existing_entity_id} + Batch Delete Entities @{expected_successful_entities_ids} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot index eee75700..e33ce605 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceMode.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/upsert +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -33,9 +34,7 @@ Upsert a batch of non existing entities Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + Batch Delete Entities @{expected_entities_ids} Upsert a batch of non existing and existing entities [Documentation] Check that you can upsert a batch of non existing and existing entities @@ -53,10 +52,8 @@ Upsert a batch of non existing and existing entities Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${new_entity_id} - Delete Entity by Id ${first_existing_entity_id} - Delete Entity by Id ${second_existing_entity_id} + @{entities_ids_to_be_deleted}= Create List ${new_entity_id} ${first_existing_entity_id} ${second_existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot index a4f14d3d..aa3d57ba 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessReplaceModeAllUpdated.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/upsert +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -29,9 +30,8 @@ Upsert a batch of existing entities Check Response Status Code Set To 204 - #TODO call Batch Delete Entities - Delete Entity by Id ${first_existing_entity_id} - Delete Entity by Id ${second_existing_entity_id} + @{entities_ids_to_be_deleted}= Create List ${first_existing_entity_id} ${second_existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot index a6ff8322..12a3b8e5 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/fullSuccessUpdateMode.robot @@ -13,6 +13,7 @@ Suite Setup Setup Initial Entities *** Variable *** ${batch_endpoint}= entityOperations/upsert +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -32,9 +33,8 @@ Upsert a batch of entities with update option Check Response Status Code Set To 201 Check Response Body Containing Array Of URIs set to @{expected_entities_ids} - #TODO call Batch Delete Entities - Delete Entity by Id ${new_entity_id} - Delete Entity by Id ${existing_entity_id} + @{entities_ids_to_be_deleted}= Create List ${new_entity_id} ${existing_entity_id} + Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** Setup Initial Entities diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot index 73e4d251..c507e7c8 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/partialSucess.robot @@ -11,6 +11,7 @@ Library Collections *** Variable *** ${batch_endpoint}= entityOperations/upsert +${batch_delete_endpoint}= entityOperations/delete ${endpoint}= entities ${building_id_prefix}= urn:ngsi-ld:Building: @@ -37,6 +38,4 @@ Upsert a batch of two valid entities and one invalid entity Check Response Status Code Set To 207 Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} - #TODO call Batch Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} + Batch Delete Entities @{expected_successful_entities_ids} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 8c438520..3a4d99d1 100644 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -74,7 +74,7 @@ Batch Update Entities Batch Delete Entities [Arguments] @{entities_ids_to_be_deleted} &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST ${batch_endpoint} body=@{entities_ids_to_be_deleted} headers=${headers} + ${response}= POST ${batch_delete_endpoint} body=@{entities_ids_to_be_deleted} headers=${headers} Output request Output response Set Test Variable ${response} -- GitLab From 78f181d7263ea9a204e144c953fb0b74f1c67c4f Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 2 Dec 2020 14:23:33 +0100 Subject: [PATCH 2/2] fix: fix create batch of entities partial success teardown --- .../BatchEntities/CreateBatchOfEntities/partialSuccess.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot index 3c92d668..6440376b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/partialSuccess.robot @@ -37,7 +37,7 @@ Create a batch of two valid entities and one invalid entity Check Response Status Code Set To 207 Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} - @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} + @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} ${existing_entity_id} Batch Delete Entities @{entities_ids_to_be_deleted} *** Keywords *** -- GitLab