From e465120dd4a7aed96f34cbfef63930c805897700 Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Mon, 25 Jan 2021 18:43:22 +0000 Subject: [PATCH 1/2] added delete context source registration suite --- .../DeleteContextSourceRegistration/007.robot | 23 +++++++++++++ .../DeleteContextSourceRegistration/008.robot | 32 +++++++++++++++++++ .../DeleteContextSourceRegistration/009.robot | 20 ++++++++++++ .../UpdateContextSourceRegistration/006.robot | 2 +- 4 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/007.robot create mode 100644 TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/008.robot create mode 100644 TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/007.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/007.robot new file mode 100644 index 00000000..210db5b9 --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/007.robot @@ -0,0 +1,23 @@ +*** Settings *** +Documentation Check that you can delete a context source registration by id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variable *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= registration-sample.jsonld + +*** Test Case *** +Delete a context source registration by id + [Documentation] Check that you can delete a context source registration by id + [Tags] mandatory + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${registration_payload_file_path} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${response}= Delete Context Source Registration ${registration_id} + Check Response Status Code 204 ${response['status']} diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/008.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/008.robot new file mode 100644 index 00000000..b76f552f --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/008.robot @@ -0,0 +1,32 @@ +*** Settings *** +Documentation Check that you cannot delete a context source registration under some conditions +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Delete Context Source + +*** Variable *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${filename}= registration-sample.jsonld + +*** Test Case *** INVALID_REGISTRATION_ID +008_01_Delete a Context Source Registration if the Id is not present ${EMPTY} +008_02_Delete a Context Source Registration if the Id is not a valid URI invalidURI + +*** Keywords *** +Delete Context Source + [Arguments] ${invalid_registration_id} + [Documentation] Check that you cannot delete a context source registration under some conditions + [Tags] mandatory + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + ${payload}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${filename} + ${updated_payload}= Update Value To Json ${payload} $..id ${registration_id} + ${request} ${response}= Create Context Source Registration ${updated_payload} + Check Response Status Code 201 ${response['status']} + + ${response}= Delete Context Source Registration ${invalid_registration_id} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Context Source Registration ${registration_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot new file mode 100644 index 00000000..dedbc95c --- /dev/null +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot @@ -0,0 +1,20 @@ +*** Settings *** +Documentation Check that you cannot update a context source registration by id if the id is not known to the system +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Variable *** +${registration_id_prefix}= urn:ngsi-ld:Registration: +${registration_payload_file_path}= registration-sample.jsonld + +*** Test Case *** +Delete a context source registration by id + [Documentation] Check that you cannot update a context source registration by id if the id is not known to the system + [Tags] mandatory + ${registration_id}= Generate Random Entity Id ${registration_id_prefix} + + ${response}= Delete Context Source Registration ${registration_id} + Check Response Status Code 404 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/006.robot b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/006.robot index 952d8c5a..61b079cf 100644 --- a/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/006.robot +++ b/TP/NGSI-LD/ContextSource/Registration/UpdateContextSourceRegistration/006.robot @@ -16,7 +16,7 @@ ${filename}= registration-sample.jsonld ${fragment}= Load Json From File ${EXECDIR}/data/csourceRegistrations/${filename} ${fragment_with_id}= Update Value To Json ${fragment} $..id ${registration_id} ${response}= Update Context Source Registration ${registration_id} ${fragment_with_id} - Check Response Status Code 400 ${response['status']} + Check Response Status Code 404 ${response['status']} Check Response Body Containing ProblemDetails Element Containing Title Element ${response} [Teardown] Delete Context Source Registration ${registration_id} -- GitLab From c7c5ad98d7f120df2bd62e6f2309d6d48c2931ec Mon Sep 17 00:00:00 2001 From: Gustavo Lopes Date: Tue, 26 Jan 2021 08:18:04 +0000 Subject: [PATCH 2/2] fixed minor bugs --- .../Registration/DeleteContextSourceRegistration/009.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot index dedbc95c..33768c9d 100644 --- a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/009.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot update a context source registration by id if the id is not known to the system +Documentation Check that you cannot delete a context source registration by id if the id is not known to the system Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -11,7 +11,7 @@ ${registration_payload_file_path}= registration-sample.jsonld *** Test Case *** Delete a context source registration by id - [Documentation] Check that you cannot update a context source registration by id if the id is not known to the system + [Documentation] Check that you cannot delete a context source registration by id if the id is not known to the system [Tags] mandatory ${registration_id}= Generate Random Entity Id ${registration_id_prefix} -- GitLab