From 3b7a3f645598af62a3014b99759bc8310a34138c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 2 Oct 2023 17:35:41 +0200 Subject: [PATCH] fix: move create entity from file in the correct API resource file --- .../Provision/Entities/CreateEntity/001_02.robot | 4 ++-- .../ApiUtils/ContextInformationConsumption.resource | 12 ------------ .../ApiUtils/ContextInformationProvision.resource | 12 ++++++++++++ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot index bde69e21..dda6b86a 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -1,7 +1,7 @@ *** Settings *** Documentation Check that you cannot create an entity with an invalid request -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Create Entity With Invalid Request Scenarios @@ -23,7 +23,7 @@ Test Template Create Entity With Invalid Request Scenarios Create Entity With Invalid Request Scenarios [Documentation] Check that you cannot create an entity with an invalid request [Arguments] ${filename} ${error_type} - ${response}= Request Entity From File ${filename} + ${response}= Create Entity From File ${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ... ${response.json()} diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 70e50ef2..7782d2f0 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -197,18 +197,6 @@ Retrieve Attributes Output ${response} Retrieve Attributes RETURN ${response} -Request Entity From File - [Arguments] ${filename} - ${file_content}= Get File ${EXECDIR}/data/entities/${filename} - &{headers}= Create Dictionary Content-Type=application/ld+json - ${response}= POST - ... url=${url}/${ENTITIES_ENDPOINT_PATH} - ... data=${file_content} - ... headers=${headers} - ... expected_status=any - Output ${response} Request Entity From File - RETURN ${response} - Retrieve Entity by Id [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index b4ec511c..7a22bbdd 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -167,6 +167,18 @@ Create Entity Selecting Content Type Output ${response} Create Entity Selecting Content Type RETURN ${response} +Create Entity From File + [Arguments] ${filename} + ${file_content}= Get File ${EXECDIR}/data/entities/${filename} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... data=${file_content} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Entity From File + RETURN ${response} + Delete Entity Attributes [Arguments] ${entityId} ${attributeId} ${datasetId} ${deleteAll} ${context}=${EMPTY} &{headers}= Create Dictionary Content-Type=${CONTENT_TYPE_JSON} -- GitLab