From c6ef2a3148da8e0df2d453c152d49c2690b60275 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Mon, 15 Mar 2021 11:46:08 +0100 Subject: [PATCH 1/7] feat: add update subscription TCs --- .../UpdateSubscription/029_01.robot | 27 ++++++++++++++ .../UpdateSubscription/029_02.robot | 20 ++++++++++ .../UpdateSubscription/029_03.robot | 37 +++++++++++++++++++ .../UpdateSubscription/029_04.robot | 37 +++++++++++++++++++ .../UpdateSubscription/029_05.robot | 35 ++++++++++++++++++ .../UpdateSubscription/029_06.robot | 36 ++++++++++++++++++ .../UpdateSubscription/029_09.robot | 37 +++++++++++++++++++ .../UpdateSubscription/029_12.robot | 37 +++++++++++++++++++ .../subscription-expiresAt-update-sample.json | 3 ++ .../subscription-invalid-update-sample.json | 5 +++ .../subscription-isActive-update-sample.json | 3 ++ ...ription-null-properties-update-sample.json | 6 +++ .../fragments/subscription-update-sample.json | 9 +++++ data/subscriptions/subscription-sample.jsonld | 19 ++++++++++ resources/ApiUtils.resource | 3 +- 15 files changed, 313 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot create mode 100644 data/subscriptions/fragments/subscription-expiresAt-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-invalid-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-null-properties-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-update-sample.json create mode 100644 data/subscriptions/subscription-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot new file mode 100644 index 00000000..3e924c51 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot update a subcription: 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 +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Update Subscription With Non present Or Invalid Id + +*** Test Cases *** id +NotPresentId ${EMPTY} +InvalidId InvalidUri + +*** Variable *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Keywords *** +Update Subscription With Non present Or Invalid Id + [Arguments] ${id} + [Documentation] Check that you cannot update a subcription: 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 + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${id} ${subscription_update_fragment} + + 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/UpdateSubscription/029_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot new file mode 100644 index 00000000..92150d95 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot @@ -0,0 +1,20 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: If the NGSI-LD System does not know about the target Subscription, because there is no existing Subscription whose id (URI) is equivalent, an error of type ResourceNotFound shall be raised +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Test Case *** +Update Unknown Subscription + [Documentation] Check that you cannot update a subscription: If the NGSI-LD System does not know about the target Subscription, because there is no existing Subscription whose id (URI) is equivalent, an error of type ResourceNotFound shall be raised + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription unknownSubscription ${subscription_update_fragment} + + 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/UpdateSubscription/029_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot new file mode 100644 index 00000000..50a9ecf2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot update a subcription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised +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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-invalid-update-sample.json + +*** Test Case *** +Update Subscription With Invalid Fragment + [Documentation] Check that you cannot update a subcription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot new file mode 100644 index 00000000..3d7629e6 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: Any attempt to remove (by setting them to null in the Fragment) mandatory properties of a Subscription (clause 5.2.12) shall result in an error of type BadRequestData +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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-null-properties-update-sample.json + +*** Test Case *** +Update Subscription With Null Mandatory Properties + [Documentation] Check that you cannot update a subscription: Any attempt to remove (by setting them to null in the Fragment) mandatory properties of a Subscription (clause 5.2.12) shall result in an error of type BadRequestData + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot new file mode 100644 index 00000000..7db7a8f9 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -0,0 +1,35 @@ +*** Settings *** +Documentation Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed +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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Test Case *** +Update Subscription With Term to Uri Expansion + [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot new file mode 100644 index 00000000..85f25415 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation Check that you can update a subcription: The implementation shall modify the target 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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json + +*** Test Case *** +Update Subscription + [Documentation] Check that you can update a subcription: The implementation shall modify the target Subscription + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + #TODO Check the update in the CB + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot new file mode 100644 index 00000000..0b9b2c76 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to false and expiresAt is not present, then status shall be updated to "paused", if and only if, the previous value of status was different than "expired" +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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-isActive-update-sample.json + +*** Test Case *** +Update Subscription Status To Paused + [Documentation] Check that you can update a subscription: If isActive is equal to false and expiresAt is not present, then status shall be updated to "paused", if and only if, the previous value of status was different than "expired" + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot new file mode 100644 index 00000000..bc8f660c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised +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 +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-update-sample.json + +*** Test Case *** +Update Subscription With ExpiresAt In The Past + [Documentation] Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + 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} + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/data/subscriptions/fragments/subscription-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-expiresAt-update-sample.json new file mode 100644 index 00000000..237d2180 --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-update-sample.json @@ -0,0 +1,3 @@ +{ + "expiresAt": "2020-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-invalid-update-sample.json b/data/subscriptions/fragments/subscription-invalid-update-sample.json new file mode 100644 index 00000000..e82d4022 --- /dev/null +++ b/data/subscriptions/fragments/subscription-invalid-update-sample.json @@ -0,0 +1,5 @@ +{ + "notification":{ + "format":"keyValues" + } +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-update-sample.json b/data/subscriptions/fragments/subscription-isActive-update-sample.json new file mode 100644 index 00000000..b432cbae --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-update-sample.json @@ -0,0 +1,3 @@ +{ + "isActive": false +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-null-properties-update-sample.json b/data/subscriptions/fragments/subscription-null-properties-update-sample.json new file mode 100644 index 00000000..f044a4da --- /dev/null +++ b/data/subscriptions/fragments/subscription-null-properties-update-sample.json @@ -0,0 +1,6 @@ +{ + "notification":{ + "format":"keyValues", + "endpoint":null + } +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-update-sample.json b/data/subscriptions/fragments/subscription-update-sample.json new file mode 100644 index 00000000..81f39078 --- /dev/null +++ b/data/subscriptions/fragments/subscription-update-sample.json @@ -0,0 +1,9 @@ +{ + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.second.endpoint.org/notify", + "accept":"application/json" + } + } +} \ No newline at end of file diff --git a/data/subscriptions/subscription-sample.jsonld b/data/subscriptions/subscription-sample.jsonld new file mode 100644 index 00000000..fd713519 --- /dev/null +++ b/data/subscriptions/subscription-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" + ] +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 28af5b77..efa0f2c6 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -21,6 +21,7 @@ ${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH} temporal/entityOperations ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations ${SUBSCRIPTION_ENDPOINT_PATH} subscriptions/ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions +${SUBSCRIPTION_ENDPOINT_PATH} subscriptions ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json @@ -842,4 +843,4 @@ Query Temporal Representation Of Entities With Return ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH} headers=${headers} query=${params} ${request}= Output request Output response - [return] ${request} ${response} \ No newline at end of file + [return] ${request} ${response} -- GitLab From 7aae85972096319ae0a7d52c97c2fbd69a9c7f03 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Tue, 16 Mar 2021 11:25:37 +0100 Subject: [PATCH 2/7] feat: implement tcs for update subscription --- .../UpdateSubscription/029_05.robot | 6 ++- .../UpdateSubscription/029_07.robot | 41 ++++++++++++++++++ .../UpdateSubscription/029_08.robot | 43 +++++++++++++++++++ .../UpdateSubscription/029_09.robot | 2 +- .../UpdateSubscription/029_11.robot | 42 ++++++++++++++++++ ...subscription-building-entities-sample.json | 7 +++ ...iption-expiresAt-future-update-sample.json | 3 ++ ...isActive-expiresAt-null-update-sample.json | 4 ++ ...tion-isActive-expiresAt-update-sample.json | 4 ++ ...ive-null-expiresAt-null-update-sample.json | 4 ++ ...isActive-null-expiresAt-update-sample.json | 4 ++ ...scription-isActive-null-update-sample.json | 3 ++ .../subscription-inactive-sample.jsonld | 20 +++++++++ resources/ApiUtils.resource | 10 ++++- 14 files changed, 188 insertions(+), 5 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot create mode 100644 data/subscriptions/fragments/subscription-building-entities-sample.json create mode 100644 data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json create mode 100644 data/subscriptions/fragments/subscription-isActive-null-update-sample.json create mode 100644 data/subscriptions/subscription-inactive-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot index 7db7a8f9..f94da018 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -10,7 +10,7 @@ Suite Teardown Delete Initial Subscriptions *** Variable *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld -${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-update-sample.json +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-building-entities-sample.json *** Test Case *** Update Subscription With Term to Uri Expansion @@ -18,9 +18,11 @@ Update Subscription With Term to Uri Expansion [Tags] mandatory ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + # TODO update subscription with another context providing new expanded format for the entity type Building + Update Subscription ${subscription_id} ${subscription_update_fragment} ${ngsild_test_suite_context} Check Response Status Code Set To 204 + #TODO Check the update in the CB with the new context (Building should be retunred compacted) *** Keywords *** Setup Initial Subscriptions diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot new file mode 100644 index 00000000..d29a768e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you can update a subscription: If isActive is equal to true or null and expiresAt is not present, then status shall be updated to "active", if and only if, the previous value of status was different than "expired" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Activate Paused Subscription With isActive Member +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +ActiveTrue subscriptions/fragments/subscription-isActive-update-sample.json +ActiveNull subscriptions/fragments/subscription-isActive-null-update-sample.json + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + +*** Keywords *** +Activate Paused Subscription With isActive Member + [Arguments] ${subscription_update_fragment_file_path} + [Documentation] Check that you can update a subscription: If isActive is equal to true or null and expiresAt is not present, then status shall be updated to "active", if and only if, the previous value of status was different than "expired" + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot new file mode 100644 index 00000000..2b98f2f8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that you can update a subcription: If isActive is equal to true or null and expiresAt is null or corresponds to a DateTime in the future, then status shall be updated to "active" +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Template Activate Paused Subscription With isActive And ExpiresAt Members +Suite Setup Setup Initial Subscriptions +Suite Teardown Delete Initial Subscriptions + +*** Test Cases *** SUBSCRIPTION_UPDATE_FRAGMENT_FILE_PATH +ActiveTrueExpiresAtNull subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json +ActiveTrueExpiresAt subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json +ActiveNullExpiresAtNull subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json +ActiveNullExpiresAt subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json + +*** Variable *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld + +*** Keywords *** +Activate Paused Subscription With isActive And ExpiresAt Members + [Arguments] ${subscription_update_fragment_file_path} + [Documentation] Check that you can update a subcription: If isActive is equal to true or null and expiresAt is null or corresponds to a DateTime in the future, then status shall be updated to "active" + [Tags] mandatory + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot index 0b9b2c76..4b5ecbe3 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot @@ -22,7 +22,7 @@ Update Subscription Status To Paused Check Response Status Code Set To 204 Retrieve Subscription ${subscription_id} - Check Response Body Containing an Attribute set to status active + Check Response Body Containing an Attribute set to status paused *** Keywords *** Setup Initial Subscriptions diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot new file mode 100644 index 00000000..b95a3a35 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" +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-inactive-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-future-update-sample.json + +*** Test Case *** +Activate Expired Subscription + [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" + [Tags] mandatory + + + ${subscription_expired_update_fragment}= Load Test Sample subscriptions/fragments/subscription-expiresAt-update-sample.json + # Update subscription to expired + Update Subscription ${subscription_id} ${subscription_expired_update_fragment} + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + Update Subscription ${subscription_id} ${subscription_update_fragment} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +*** Keywords *** +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} + + Create Subscription ${subscription_payload} + + Set Suite Variable ${subscription_id} + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} diff --git a/data/subscriptions/fragments/subscription-building-entities-sample.json b/data/subscriptions/fragments/subscription-building-entities-sample.json new file mode 100644 index 00000000..57564a2b --- /dev/null +++ b/data/subscriptions/fragments/subscription-building-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Building" + } + ] +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json b/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json new file mode 100644 index 00000000..e4f92ec3 --- /dev/null +++ b/data/subscriptions/fragments/subscription-expiresAt-future-update-sample.json @@ -0,0 +1,3 @@ +{ + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json new file mode 100644 index 00000000..5cc9b6ab --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-expiresAt-null-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": true, + "expiresAt": null +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json new file mode 100644 index 00000000..f72957cd --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-expiresAt-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": true, + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json new file mode 100644 index 00000000..1ec15711 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-null-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": null, + "expiresAt": null +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json new file mode 100644 index 00000000..1780d379 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-expiresAt-update-sample.json @@ -0,0 +1,4 @@ +{ + "isActive": null, + "expiresAt": "2030-08-01T22:07:00Z" +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-isActive-null-update-sample.json b/data/subscriptions/fragments/subscription-isActive-null-update-sample.json new file mode 100644 index 00000000..fe8bb4e2 --- /dev/null +++ b/data/subscriptions/fragments/subscription-isActive-null-update-sample.json @@ -0,0 +1,3 @@ +{ + "isActive": null +} \ No newline at end of file diff --git a/data/subscriptions/subscription-inactive-sample.jsonld b/data/subscriptions/subscription-inactive-sample.jsonld new file mode 100644 index 00000000..a00ea736 --- /dev/null +++ b/data/subscriptions/subscription-inactive-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "isActive": false, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" + ] +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index efa0f2c6..351ad277 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -673,13 +673,15 @@ Create Subscription [return] ${response} Update Subscription - [Arguments] ${subscription_id} ${fragment_filename} ${content_type} ${accept}=${EMPTY} + [Arguments] ${subscription_id} ${fragment_filename} ${content_type} ${accept}=${EMPTY} ${context}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${subscription_update_fragment}= Load Json From File ${EXECDIR}/data/${fragment_filename} ${response}= PATCH ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} body=${subscription_update_fragment} headers=${headers} Output request Output response + Set Test Variable ${response} [return] ${response} Delete Subscription @@ -687,6 +689,7 @@ Delete Subscription ${response}= DELETE ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} Output request Output response + Set Test Variable ${response} [return] ${response} Query Subscriptions @@ -702,13 +705,16 @@ Query Subscriptions [return] ${response} Retrieve Subscription - [Arguments] ${id} ${accept}=${EMPTY} + [Arguments] ${id} ${accept}=${EMPTY} ${context}=${EMPTY} &{headers}= Create Dictionary + Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${response}= GET ${SUBSCRIPTION_ENDPOINT_PATH}${id} headers=${headers} ${request}= Output request Output response + Set Test Variable ${response} [return] ${request} ${response} Update Context Source Registration Subscription By Selecting Content Type -- GitLab From d6574c17fc18df06ad7c1350681861bbab003773 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 17 Mar 2021 10:14:02 +0100 Subject: [PATCH 3/7] fix: fix keywords conflicts --- resources/ApiUtils.resource | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 351ad277..1539fbb4 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -21,7 +21,6 @@ ${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH} temporal/entityOperations ${CONTEXT_SOURCE_REGISTRATION_ENDPOINT_PATH} csourceRegistrations ${SUBSCRIPTION_ENDPOINT_PATH} subscriptions/ ${CONTEXT_SOURCE_REGISTRATION_SUBSCRIPTION_ENDPOINT_PATH} csourceSubscriptions -${SUBSCRIPTION_ENDPOINT_PATH} subscriptions ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json -- GitLab From 6df7b9028e46a99a1b45a508dd1e98afec57a8b3 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 17 Mar 2021 10:35:19 +0100 Subject: [PATCH 4/7] feat: switch to new keywords for subscriptions --- .../UpdateSubscription/029_01.robot | 3 +- .../UpdateSubscription/029_02.robot | 3 +- .../UpdateSubscription/029_03.robot | 6 +-- .../UpdateSubscription/029_04.robot | 6 +-- .../UpdateSubscription/029_05.robot | 7 +--- .../UpdateSubscription/029_06.robot | 6 +-- .../UpdateSubscription/029_07.robot | 6 +-- .../UpdateSubscription/029_08.robot | 6 +-- .../UpdateSubscription/029_09.robot | 6 +-- .../UpdateSubscription/029_10.robot | 39 +++++++++++++++++++ .../UpdateSubscription/029_11.robot | 27 +++++-------- .../UpdateSubscription/029_12.robot | 37 ------------------ resources/ApiUtils.resource | 5 ++- 13 files changed, 68 insertions(+), 89 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot delete mode 100644 TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot index 3e924c51..679523a4 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_01.robot @@ -19,8 +19,7 @@ Update Subscription With Non present Or Invalid Id [Documentation] Check that you cannot update a subcription: 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 - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${id} ${subscription_update_fragment} + Update Subscription ${id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 400 Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot index 92150d95..3c64d310 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_02.robot @@ -12,8 +12,7 @@ Update Unknown Subscription [Documentation] Check that you cannot update a subscription: If the NGSI-LD System does not know about the target Subscription, because there is no existing Subscription whose id (URI) is equivalent, an error of type ResourceNotFound shall be raised [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription unknownSubscription ${subscription_update_fragment} + Update Subscription unknownSubscription ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 404 Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot index 50a9ecf2..9a787102 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_03.robot @@ -17,8 +17,7 @@ Update Subscription With Invalid Fragment [Documentation] Check that you cannot update a subcription: If the data types and restriction are not met by the Subscription Fragment, then an error of type BadRequestData shall be raised [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 400 Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} @@ -27,9 +26,8 @@ Update Subscription With Invalid Fragment *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot index 3d7629e6..e22a5f35 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_04.robot @@ -17,8 +17,7 @@ Update Subscription With Null Mandatory Properties [Documentation] Check that you cannot update a subscription: Any attempt to remove (by setting them to null in the Fragment) mandatory properties of a Subscription (clause 5.2.12) shall result in an error of type BadRequestData [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 400 Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} @@ -27,9 +26,8 @@ Update Subscription With Null Mandatory Properties *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot index f94da018..5f6dc79f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -17,9 +17,7 @@ Update Subscription With Term to Uri Expansion [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - # TODO update subscription with another context providing new expanded format for the entity type Building - Update Subscription ${subscription_id} ${subscription_update_fragment} ${ngsild_test_suite_context} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 204 #TODO Check the update in the CB with the new context (Building should be retunred compacted) @@ -27,9 +25,8 @@ Update Subscription With Term to Uri Expansion *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot index 85f25415..b772fa1f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -17,8 +17,7 @@ Update Subscription [Documentation] Check that you can update a subcription: The implementation shall modify the target Subscription [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 204 #TODO Check the update in the CB @@ -26,9 +25,8 @@ Update Subscription *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot index d29a768e..bfbb5d6d 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_07.robot @@ -22,8 +22,7 @@ Activate Paused Subscription With isActive Member [Documentation] Check that you can update a subscription: If isActive is equal to true or null and expiresAt is not present, then status shall be updated to "active", if and only if, the previous value of status was different than "expired" [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 204 Retrieve Subscription ${subscription_id} @@ -31,9 +30,8 @@ Activate Paused Subscription With isActive Member Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot index 2b98f2f8..2472613f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_08.robot @@ -24,8 +24,7 @@ Activate Paused Subscription With isActive And ExpiresAt Members [Documentation] Check that you can update a subcription: If isActive is equal to true or null and expiresAt is null or corresponds to a DateTime in the future, then status shall be updated to "active" [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 204 Retrieve Subscription ${subscription_id} @@ -33,9 +32,8 @@ Activate Paused Subscription With isActive And ExpiresAt Members Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot index 4b5ecbe3..b414200e 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_09.robot @@ -17,8 +17,7 @@ Update Subscription Status To Paused [Documentation] Check that you can update a subscription: If isActive is equal to false and expiresAt is not present, then status shall be updated to "paused", if and only if, the previous value of status was different than "expired" [Tags] mandatory - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} Check Response Status Code Set To 204 Retrieve Subscription ${subscription_id} @@ -27,9 +26,8 @@ Update Subscription Status To Paused *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot new file mode 100644 index 00000000..0b463755 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" +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-inactive-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-future-update-sample.json + +*** Test Case *** +Activate Expired Subscription + [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" + [Tags] mandatory + + + # Update subscription to expired + Update Subscription ${subscription_id} subscriptions/fragments/subscription-expiresAt-update-sample.json ${CONTENT_TYPE_JSON} + + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + + Check Response Status Code Set To 204 + Retrieve Subscription ${subscription_id} + Check Response Body Containing an Attribute set to status active + +*** 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/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot index b95a3a35..4c38313d 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_11.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" +Documentation Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -9,32 +9,25 @@ Suite Teardown Delete Initial Subscriptions *** Variable *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-inactive-sample.jsonld -${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-future-update-sample.json +${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-update-sample.json *** Test Case *** -Activate Expired Subscription - [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" +Update Subscription With ExpiresAt In The Past + [Documentation] Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised [Tags] mandatory + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} - ${subscription_expired_update_fragment}= Load Test Sample subscriptions/fragments/subscription-expiresAt-update-sample.json - # Update subscription to expired - Update Subscription ${subscription_id} ${subscription_expired_update_fragment} - - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} - - Check Response Status Code Set To 204 - Retrieve Subscription ${subscription_id} - Check Response Body Containing an Attribute set to status active + 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} *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot deleted file mode 100644 index bc8f660c..00000000 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_12.robot +++ /dev/null @@ -1,37 +0,0 @@ -*** Settings *** -Documentation Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised -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 -${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-expiresAt-update-sample.json - -*** Test Case *** -Update Subscription With ExpiresAt In The Past - [Documentation] Check that you cannot update a subscription: If expiresAt is included but referring to a DateTime in the past, then a BadRequestData error shall be raised - [Tags] mandatory - - ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} - Update Subscription ${subscription_id} ${subscription_update_fragment} - - 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} - -*** Keywords *** -Setup Initial Subscriptions - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - - Create Subscription ${subscription_payload} - - Set Suite Variable ${subscription_id} - -Delete Initial Subscriptions - Delete Subscription ${subscription_id} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 1539fbb4..683b26a1 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -661,9 +661,10 @@ Update Context Source Registration Subscription From File Set Test Variable ${response} Create Subscription - [Arguments] ${subscription_id} ${filename_path} ${content_type} ${accept}=${EMPTY} + [Arguments] ${subscription_id} ${filename_path} ${content_type} ${accept}=${EMPTY} ${context}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" ${subscription_payload}= Load Json From File ${EXECDIR}/data/${filename_path} ${subscription}= Update Value To Json ${subscription_payload} $..id ${subscription_id} ${response}= POST ${SUBSCRIPTION_ENDPOINT_PATH} body=${subscription} headers=${headers} @@ -688,7 +689,7 @@ Delete Subscription ${response}= DELETE ${SUBSCRIPTION_ENDPOINT_PATH}${subscription_id} Output request Output response - Set Test Variable ${response} + Set Suite Variable ${response} [return] ${response} Query Subscriptions -- GitLab From c0d75ecda7f99ccaeb09befcab852e9528ceb3ee Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 17 Mar 2021 11:02:04 +0100 Subject: [PATCH 5/7] feat: add missing checks for update subscription --- .../UpdateSubscription/029_05.robot | 13 ++++++++++--- .../UpdateSubscription/029_06.robot | 11 +++++++++-- .../UpdateSubscription/029_10.robot | 1 - ...ption-vehicle-expanded-types-sample.jsonld | 19 +++++++++++++++++++ .../subscription-vehicle-sample.jsonld | 19 +++++++++++++++++++ .../subscription-vehicle-entities-sample.json | 7 +++++++ 6 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld create mode 100644 data/subscriptions/expected/subscription-vehicle-sample.jsonld create mode 100644 data/subscriptions/fragments/subscription-vehicle-entities-sample.json diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot index 5f6dc79f..60aca577 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_05.robot @@ -10,17 +10,24 @@ Suite Teardown Delete Initial Subscriptions *** Variable *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_payload_file_path}= subscriptions/subscription-sample.jsonld -${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-building-entities-sample.json +${subscription_update_fragment_file_path}= subscriptions/fragments/subscription-vehicle-entities-sample.json +${expected_subscription_payload_file_path}= subscriptions/expected/subscription-vehicle-sample.jsonld +${expected_expanded_subscription_payload_file_path}= subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld *** Test Case *** Update Subscription With Term to Uri Expansion [Documentation] Check that you can update a subcription: Term to URI expansion of Attribute names shall be observed [Tags] mandatory - Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} Check Response Status Code Set To 204 - #TODO Check the update in the CB with the new context (Building should be retunred compacted) + + Retrieve Subscription ${subscription_id} context=${ngsild_test_suite_context} + Check Response Body Containing Subscription element ${expected_subscription_payload_file_path} ${subscription_id} + + Retrieve Subscription ${subscription_id} + Check Response Body Containing Subscription element ${expected_expanded_subscription_payload_file_path} ${subscription_id} *** Keywords *** Setup Initial Subscriptions diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot index b772fa1f..fd4a29e2 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -17,18 +17,25 @@ Update Subscription [Documentation] Check that you can update a subcription: The implementation shall modify the target Subscription [Tags] mandatory - Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} + Update Subscription ${subscription_id} ${subscription_update_fragment_file_path} ${CONTENT_TYPE_JSON} context=${ngsild_test_suite_context} Check Response Status Code Set To 204 - #TODO Check the update in the CB + + ${subscription_update_fragment}= Load Test Sample ${subscription_update_fragment_file_path} + ${subscription}= Upsert Element In Entity ${subscription_payload} ${subscription_update_fragment} + Retrieve Subscription ${subscription_id} accept=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + ${ignored_attributes}= Create List ${status_regex_expr} + Check Updated Resource Set To ${subscription} *** Keywords *** Setup Initial Subscriptions ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} + Set Suite Variable ${subscription_payload} Delete Initial Subscriptions Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot index 0b463755..6cdf122f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_10.robot @@ -17,7 +17,6 @@ Activate Expired Subscription [Documentation] Check that you can update a subscription: If only expiresAt is included and refers to a DateTime in the future or is null, then status shall be updated to "active", if and only if the previous value of status was "expired" [Tags] mandatory - # Update subscription to expired Update Subscription ${subscription_id} subscriptions/fragments/subscription-expiresAt-update-sample.json ${CONTENT_TYPE_JSON} diff --git a/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld b/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld new file mode 100644 index 00000000..5cb80bfe --- /dev/null +++ b/data/subscriptions/expected/subscription-vehicle-expanded-types-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"https://ngsi-ld-test-suite/context#Vehicle" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/expected/subscription-vehicle-sample.jsonld b/data/subscriptions/expected/subscription-vehicle-sample.jsonld new file mode 100644 index 00000000..ae7a20da --- /dev/null +++ b/data/subscriptions/expected/subscription-vehicle-sample.jsonld @@ -0,0 +1,19 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Vehicle" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "@context":[ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/fragments/subscription-vehicle-entities-sample.json b/data/subscriptions/fragments/subscription-vehicle-entities-sample.json new file mode 100644 index 00000000..ff01dca7 --- /dev/null +++ b/data/subscriptions/fragments/subscription-vehicle-entities-sample.json @@ -0,0 +1,7 @@ +{ + "entities":[ + { + "type":"Vehicle" + } + ] +} \ No newline at end of file -- GitLab From 05627bc22da1e767609d473421070e4253c31eb8 Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 17 Mar 2021 11:27:44 +0100 Subject: [PATCH 6/7] fix: revert in https for api errors types --- resources/ApiUtils.resource | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 683b26a1..c7156c82 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -26,11 +26,11 @@ ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json ${CONTENT_TYPE_MERGE_PATCH_JSON} application/merge-patch+json -${ERROR_TYPE_BAD_REQUEST_DATA} http://uri.etsi.org/ngsi-ld/errors/BadRequestData -${ERROR_TYPE_INVALID_REQUEST} http://uri.etsi.org/ngsi-ld/errors/InvalidRequest -${ERROR_TYPE_RESOURCE_NOT_FOUND} http://uri.etsi.org/ngsi-ld/errors/ResourceNotFound -${ERROR_TYPE_ALREADY_EXISTS} http://uri.etsi.org/ngsi-ld/errors/AlreadyExists -${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} http://uri.etsi.org/ngsi-ld/errors/LDContextNotAvailable +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound +${ERROR_TYPE_ALREADY_EXISTS} https://uri.etsi.org/ngsi-ld/errors/AlreadyExists +${ERROR_TYPE_LD_CONTEXT_NOT_AVAILABLE} https://uri.etsi.org/ngsi-ld/errors/LDContextNotAvailable ${response} -- GitLab From 28ccb34b9532cc6a4943c108e867d205f48a1f0e Mon Sep 17 00:00:00 2001 From: Houcem Kacem Date: Wed, 17 Mar 2021 12:30:05 +0100 Subject: [PATCH 7/7] fix: ignore subscription status from comparison --- .../Subscription/UpdateSubscription/029_06.robot | 2 +- resources/AssertionUtils.resource | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot index fd4a29e2..606931b9 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -25,7 +25,7 @@ Update Subscription ${subscription}= Upsert Element In Entity ${subscription_payload} ${subscription_update_fragment} Retrieve Subscription ${subscription_id} accept=${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} ${ignored_attributes}= Create List ${status_regex_expr} - Check Updated Resource Set To ${subscription} + Check Updated Resource Set To ${subscription} ${ignored_attributes} *** Keywords *** Setup Initial Subscriptions diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 0fc84a3f..db22588f 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -305,6 +305,7 @@ Check Response Body Containing One Registration element ${registration}= Update Value To Json ${payload} $..id ${response_body['id']} ${comparison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${registration} ${instance_id_regex_expr} Should Be True ${comparison_result} msg=Entity Comparison Failed + Check Resource Set To [Arguments] ${resource} ${ignored_keys}=${None} ${error_message}=${EMPTY} -- GitLab