diff --git a/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..d039eb9f02149df700f3717689f2caaac7d0e0ca --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_01.robot @@ -0,0 +1,22 @@ +*** Settings *** +Documentation Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Retrieve Subscription With Non present Or Invalid Id + +*** Test Cases *** id +NotPresentId ${EMPTY} +InvalidId InvalidUri + +*** Keywords *** +Retrieve Subscription With Non present Or Invalid Id + [Arguments] ${id} + [Documentation] Check that you cannot retrieve a subscription: If the subscription Id is not present or it is not a valid URI, then an error of type BadRequestData shall be raised + [Tags] mandatory + + Retrieve Subscription ${id} + + Check Response Status Code Set To 400 + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..bca5702225d421b57a4dc9cb0a125b8672f71034 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_02.robot @@ -0,0 +1,15 @@ +*** Settings *** +Documentation Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +*** Test Case *** +Retrieve Unknown Subscription + [Documentation] Check that you cannot retrieve a subscription: If the identifier provided does not correspond to any existing subscription in the system then an error of type ResourceNotFound shall be raised + [Tags] mandatory + + Retrieve Subscription unknownSubscription + + Check Response Status Code Set To 404 + 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/ContextInformation/Subscription/RetrieveSubscription/030_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..1cfdfa2d49e6a1fd1e23374e84d9d6f21f28e6fe --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/RetrieveSubscription/030_03.robot @@ -0,0 +1,33 @@ +*** Settings *** +Documentation Check that you can retrieve a subscription +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld + +*** Test Case *** +Retrieve Subscription + [Documentation] Check that you can retrieve a subscription + [Tags] mandatory + + Retrieve Subscription ${subscription_id} context=${ngsild_test_suite_context} + + Check Response Status Code Set To 200 + Check Response Body Containing Subscription element ${subscription_payload_file_path} ${subscription_id} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index c7156c82393da5b750ae66417e7ef168e5c1fa93..3a024e6ecfc09e236730fd476614b58609608a77 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -693,7 +693,7 @@ Delete Subscription [return] ${response} Query Subscriptions - [Arguments] ${limit}=${EMPTY} ${accept}=${EMPTY} + [Arguments] ${limit}=${EMPTY} ${accept}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept}