From 3f93ca6cc76f5297838eb47511fc43cf585d6611 Mon Sep 17 00:00:00 2001 From: ScorpioBroker <55130839+ScorpioBroker@users.noreply.github.com> Date: Tue, 15 Apr 2025 23:41:51 +0200 Subject: [PATCH 1/2] expecting errors array in cases which are have errors specific to the posted entities --- .../CommonResponses/VerifyLdContextNotAvailable/043_01.robot | 5 ++++- .../BatchEntities/CreateBatchOfEntities/003_06.robot | 2 +- .../BatchEntities/CreateBatchOfEntities/003_08.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/004_06.robot | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot index 7de6c0e56..2011f41a9 100644 --- a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot @@ -76,7 +76,10 @@ ${registration_filename}= csourceRegistrations/context-source-registration ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code ${expected_status_code} ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} + ... ${response.json()['errors'][0]} + ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()['errors'][1]} ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} [Teardown] Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_created} 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 0efc47374..96ebf334d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -22,6 +22,6 @@ ${building_id_prefix}= urn:ngsi-ld:Building: Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} + ... ${response.json()['errors'][0]} ... ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.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 389bc8462..9b51f771e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -22,6 +22,6 @@ ${building_id_prefix}= urn:ngsi-ld:Building: Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} + ... ${response.json()['errors'][0]} ... ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} 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 29cbb2836..6ac22d9db 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -23,6 +23,6 @@ Batch Upsert Entity With Invalid Request Scenarios ${response}= Batch Request Entities From File upsert filename=${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} + ... ${response.json()['errors'][0]} ... ${problem_type} Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} -- GitLab From d66283268cf51e8eea05e7ed75ce55cd031bb5d1 Mon Sep 17 00:00:00 2001 From: ScorpioBroker <55130839+ScorpioBroker@users.noreply.github.com> Date: Wed, 16 Apr 2025 00:03:35 +0200 Subject: [PATCH 2/2] check error subfield --- .../CommonResponses/VerifyLdContextNotAvailable/043_01.robot | 4 ++-- .../BatchEntities/CreateBatchOfEntities/003_06.robot | 2 +- .../BatchEntities/CreateBatchOfEntities/003_08.robot | 2 +- .../BatchEntities/UpsertBatchOfEntities/004_06.robot | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot index 2011f41a9..11ca9589b 100644 --- a/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot +++ b/TP/NGSI-LD/CommonBehaviours/CommonResponses/VerifyLdContextNotAvailable/043_01.robot @@ -76,10 +76,10 @@ ${registration_filename}= csourceRegistrations/context-source-registration ${response}= Batch Create Entities @{entities_to_be_created} content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code ${expected_status_code} ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]} + ... ${response.json()['errors'][0]['error']} ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][1]} + ... ${response.json()['errors'][1]['error']} ... ${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} [Teardown] Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_created} 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 96ebf334d..6fe6fbda3 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_06.robot @@ -22,6 +22,6 @@ ${building_id_prefix}= urn:ngsi-ld:Building: Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]} + ... ${response.json()['errors'][0]['error']} ... ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.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 9b51f771e..f4d2a427e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_08.robot @@ -22,6 +22,6 @@ ${building_id_prefix}= urn:ngsi-ld:Building: Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]} + ... ${response.json()['errors'][0]['error']} ... ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} 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 6ac22d9db..ea997a192 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_06.robot @@ -23,6 +23,6 @@ Batch Upsert Entity With Invalid Request Scenarios ${response}= Batch Request Entities From File upsert filename=${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()['errors'][0]} + ... ${response.json()['errors'][0]['error']} ... ${problem_type} Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} -- GitLab