From 3ce39dfcbe73f19c8b1db254db4a60cadc4471c9 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Tue, 8 Aug 2023 10:36:23 +0200 Subject: [PATCH 1/4] feat: add scope and scopeQ tests - feat: add TC for deletion the scope attribute in an entity - feat: add TC for append of a scope attribute to an entity - feat: add TC for update of a scope in an entity --- .../Entity/QueryEntities/019_01_06.robot | 70 ++++++++++ .../Entities/CreateEntity/001_01.robot | 2 +- .../Entities/CreateEntity/001_02.robot | 2 +- .../Entities/CreateEntity/001_11.robot | 51 +++++++ .../AppendEntityAttributes/010_07.robot | 66 +++++++++ .../DeleteEntityAttribute/013_04.robot | 47 +++++++ .../UpdateEntityAttributes/011_05.robot | 66 +++++++++ ...le.jsonld => building-minimal-sample.json} | 0 .../building-minimal-with-many-scopes.json | 5 + .../building-minimal-with-one-scope.json | 5 + ...uilding-minimal-compacted-expectation.json | 4 + ...ng-minimal-with-one-scope-expectation.json | 5 + ...g-minimal-with-two-scopes-expectation.json | 5 + .../fragmentEntities/one-scope-fragment.json | 3 + doc/analysis/requests.py | 6 +- .../Consumption/019_01_06.json | 127 ++++++++++++++++++ .../ContextInformation/Provision/001_01.json | 4 +- .../ContextInformation/Provision/001_02.json | 2 +- .../ContextInformation/Provision/011_05.json | 58 ++++++++ .../ContextInformation/Provision/013_04.json | 38 ++++++ .../test_ContextInformation_Consumption.py | 7 + .../test_ContextInformation_Provision.py | 14 ++ .../ContextInformationConsumption.resource | 2 + 23 files changed, 582 insertions(+), 7 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot rename data/entities/{building-minimal-without-context-sample.jsonld => building-minimal-sample.json} (100%) create mode 100644 data/entities/building-minimal-with-many-scopes.json create mode 100644 data/entities/building-minimal-with-one-scope.json create mode 100644 data/entities/expectations/building-minimal-compacted-expectation.json create mode 100644 data/entities/expectations/building-minimal-with-one-scope-expectation.json create mode 100644 data/entities/expectations/building-minimal-with-two-scopes-expectation.json create mode 100644 data/entities/fragmentEntities/one-scope-fragment.json create mode 100644 doc/files/ContextInformation/Consumption/019_01_06.json create mode 100644 doc/files/ContextInformation/Provision/011_05.json create mode 100644 doc/files/ContextInformation/Provision/013_04.json diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot new file mode 100644 index 00000000..02781757 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot @@ -0,0 +1,70 @@ +*** Settings *** +Documentation Check that you can query several entities based on scopes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Setup Setup Initial Entities +Suite Teardown Delete Entities +Test Template Query several entities based on scopes + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_one_scope}= building-minimal-with-one-scope.json +${entity_many_scopes}= building-minimal-with-many-scopes.json +${entity_type}= https://ngsi-ld-test-suite/context#Building + + +*** Test Cases *** SCOPEQ EXPECTED_COUNT +019_01_06 QueryWithFullScope + [Tags] e-query 4_19 since_v1.5.1 + /Madrid/Gardens/ParqueNorte ${2} +019_01_06 QueryWithPlusMatching + [Tags] e-query 4_19 since_v1.5.1 + /Madrid/+/ParqueNorte ${2} +019_01_06 QueryWithHashMatching + [Tags] e-query 4_19 since_v1.5.1 + /CompanyA/# ${1} +019_01_06 QueryNonEmptyScope + [Tags] e-query 4_19 since_v1.5.1 + /# ${2} +019_01_06 QueryWithAndScope + [Tags] e-query 4_19 since_v1.5.1 + /Madrid/Gardens/ParqueNorte;/CompanyA/OrganizationB/UnitC ${1} +019_01_06 QueryWithOrScope + [Tags] e-query 4_19 since_v1.5.1 + /Madrid/Gardens/ParqueNorte,/CompanyA/OrganizationB/UnitC ${2} + + +*** Keywords *** +Query several entities based on scopes + [Documentation] Check that you can query several entities based on scopes + [Arguments] ${scopeq} ${expected_count} + ${response}= Query Entities + ... scopeq=${scopeq} + ... entity_types=${entity_type} + Check Response Status Code 200 ${response.status_code} + Check Response Body Containing Number Of Entities ${entity_type} ${expected_count} ${response.json()} + +Setup Initial Entities + ${entity_one_scope_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_one_scope_id} + Create Entity Selecting Content Type + ... ${entity_one_scope} + ... ${entity_one_scope_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + ${entity_many_scopes_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${entity_many_scopes_id} + Create Entity Selecting Content Type + ... ${entity_many_scopes} + ... ${entity_many_scopes_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + +Delete Entities + Delete Entity by Id ${entity_one_scope_id} + Delete Entity by Id ${entity_many_scopes_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot index 140e3887..1e500b95 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot @@ -17,7 +17,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: *** Test Cases *** FILENAME CONTENT_TYPE 001_01_01 MinimalEntity [Tags] e-create 5_6_1 - building-minimal-without-context-sample.jsonld application/json + building-minimal-sample.json application/json 001_01_02 EntityWithSimpleProperties [Tags] e-create 5_6_1 building-simple-attributes-sample.jsonld application/ld+json 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 dda6b86a..74a2e46f 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -16,7 +16,7 @@ Test Template Create Entity With Invalid Request Scenarios empty-sample.jsonld ${ERROR_TYPE_INVALID_REQUEST} 001_02_03 EntityWithNoContext [Tags] e-create 5_6_1 - building-minimal-without-context-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + building-minimal-sample.json ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot new file mode 100644 index 00000000..6873dd7c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that you can create an entity with one or more scopes + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity +Test Template Create Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** FILENAME CONTENT_TYPE +001_11_01 EntityWithOneScope + [Tags] e-create 4_18 since_v1.5.1 + building-minimal-with-one-scope.json application/json +001_11_02 EntityWithManyScopes + [Tags] e-create 4_18 since_v1.5.1 + building-minimal-with-many-scopes.json application/json + + +*** Keywords *** +Create Entity Scenarios + [Documentation] Check that you can create an entity with one or more scopes + [Arguments] ${filename} ${content_type} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${content_type} + Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${entity_id} ${response.headers} + ${created_entity}= Load Test Sample entities/${filename} ${entity_id} + IF '${content_type}'=='application/json' + ${response1}= Retrieve Entity by Id ${entity_id} ${content_type} + END + IF '${content_type}'=='application/ld+json' + ${response1}= Retrieve Entity by Id + ... ${entity_id} + ... ${content_type} + ... context=${ngsild_test_suite_context} + END + Check Created Resource Set To ${created_entity} ${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot new file mode 100644 index 00000000..939ec05e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you can append a scope to an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-minimal-with-one-scope.json +${scope_fragment_filename}= one-scope-fragment.json + + +*** Test Cases *** +010_07_01 Append scope to an entity with overwrite enabled + [Documentation] Check that scope is replaced if overwrite is enabled + [Tags] ea-append 5_6_3 4_18 since_v1.5.1 + ${response}= Append Entity Attributes + ... ${entity_id} + ... ${scope_fragment_filename} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${expectation_filename}= Set Variable building-minimal-with-one-scope-expectation.json + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response}= Retrieve Entity by Id + ... ${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Updated Resource Set To ${entity_expectation_payload} ${response.json()} + +010_07_01 Append scope to an entity with overwrite disabled + [Documentation] Check that scope is appended if overwrite is disabled + [Tags] ea-append 5_6_3 4_18 since_v1.5.1 + ${response}= Append Entity Attributes With Parameters + ... ${entity_id} + ... ${scope_fragment_filename} + ... ${CONTENT_TYPE_JSON} + ... noOverwrite + Check Response Status Code 204 ${response.status_code} + ${expectation_filename}= Set Variable building-minimal-with-two-scopes-expectation.json + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response}= Retrieve Entity by Id + ... ${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Updated Resource Set To ${entity_expectation_payload} ${response.json()} + + +*** Keywords *** +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot new file mode 100644 index 00000000..94582d9d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot @@ -0,0 +1,47 @@ +*** Settings *** +Documentation Check that you can delete a scope from an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Initial Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-minimal-with-one-scope.json +${expectation_filename}= building-minimal-compacted-expectation.json + + +*** Test Cases *** +013_04 Delete scope from an entity + [Documentation] Check that you can delete a scope from an entity + [Tags] ea-delete 5_6_5 4_18 since_v1.5.1 + ${response}= Delete Entity Attributes + ... ${entity_id} + ... scope + ... ${EMPTY} + ... false + Check Response Status Code 204 ${response.status_code} + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response}= Retrieve Entity by Id + ... ${entity_id} + ... accept=${CONTENT_TYPE_JSON} + Check Updated Resource Set To ${entity_expectation_payload} ${response.json()} + + +*** Keywords *** +Create Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot new file mode 100644 index 00000000..25914947 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that you can update a scope in an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Initial Entity + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${scope_fragment_filename}= one-scope-fragment.json + + +*** Test Cases *** +011_05_01 Update scope to an entity already having a scope + [Documentation] Check that scope is replaced if entity already has a scope + [Tags] ea-append 5_6_2 4_18 since_v1.5.1 + [Setup] Create Initial Entity building-minimal-with-one-scope.json + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${scope_fragment_filename} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 204 ${response.status_code} + ${expectation_filename}= Set Variable building-minimal-with-one-scope-expectation.json + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response}= Retrieve Entity by Id + ... ${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Updated Resource Set To ${entity_expectation_payload} ${response.json()} + +011_05_02 Update scope to an entity not having a scope + [Documentation] Check that scope is not added if entity does not already have a scope + [Tags] ea-append 5_6_2 4_18 since_v1.5.1 + [Setup] Create Initial Entity building-minimal-sample.json + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${scope_fragment_filename} + ... ${CONTENT_TYPE_JSON} + Check Response Status Code 207 ${response.status_code} + ${expectation_filename}= Set Variable building-minimal-compacted-expectation.json + ${entity_expectation_payload}= Load Test Sample entities/expectations/${expectation_filename} ${entity_id} + ${response}= Retrieve Entity by Id + ... ${entity_id} + ... accept=${CONTENT_TYPE_JSON} + ... context=${ngsild_test_suite_context} + Check Updated Resource Set To ${entity_expectation_payload} ${response.json()} + + +*** Keywords *** +Create Initial Entity + [Arguments] ${filename} + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/data/entities/building-minimal-without-context-sample.jsonld b/data/entities/building-minimal-sample.json similarity index 100% rename from data/entities/building-minimal-without-context-sample.jsonld rename to data/entities/building-minimal-sample.json diff --git a/data/entities/building-minimal-with-many-scopes.json b/data/entities/building-minimal-with-many-scopes.json new file mode 100644 index 00000000..8c98aac8 --- /dev/null +++ b/data/entities/building-minimal-with-many-scopes.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "scope": ["/Madrid/Gardens/ParqueNorte", "/CompanyA/OrganizationB/UnitC"] +} diff --git a/data/entities/building-minimal-with-one-scope.json b/data/entities/building-minimal-with-one-scope.json new file mode 100644 index 00000000..9c4ce2b5 --- /dev/null +++ b/data/entities/building-minimal-with-one-scope.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "scope": "/Madrid/Gardens/ParqueNorte" +} \ No newline at end of file diff --git a/data/entities/expectations/building-minimal-compacted-expectation.json b/data/entities/expectations/building-minimal-compacted-expectation.json new file mode 100644 index 00000000..78ff3565 --- /dev/null +++ b/data/entities/expectations/building-minimal-compacted-expectation.json @@ -0,0 +1,4 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building" +} \ No newline at end of file diff --git a/data/entities/expectations/building-minimal-with-one-scope-expectation.json b/data/entities/expectations/building-minimal-with-one-scope-expectation.json new file mode 100644 index 00000000..1966edd0 --- /dev/null +++ b/data/entities/expectations/building-minimal-with-one-scope-expectation.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "scope": "/CompanyA/OrganizationB/UnitC" +} \ No newline at end of file diff --git a/data/entities/expectations/building-minimal-with-two-scopes-expectation.json b/data/entities/expectations/building-minimal-with-two-scopes-expectation.json new file mode 100644 index 00000000..af3df658 --- /dev/null +++ b/data/entities/expectations/building-minimal-with-two-scopes-expectation.json @@ -0,0 +1,5 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "scope": ["/Madrid/Gardens/ParqueNorte", "/CompanyA/OrganizationB/UnitC"] +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/one-scope-fragment.json b/data/entities/fragmentEntities/one-scope-fragment.json new file mode 100644 index 00000000..e0c49f11 --- /dev/null +++ b/data/entities/fragmentEntities/one-scope-fragment.json @@ -0,0 +1,3 @@ +{ + "scope": "/CompanyA/OrganizationB/UnitC" +} \ No newline at end of file diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index ba1d1441..2810b9a5 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -85,7 +85,7 @@ class Requests: 'params': ['entity_ids', 'entity_types', 'accept', 'attrs', 'context', 'geoproperty', 'options', 'limit', 'entity_id_pattern', - 'georel', 'coordinates', 'geometry', 'count', 'q'] + 'scopeq', 'georel', 'coordinates', 'geometry', 'count', 'q'] }, 'Query Entities Via POST': { 'positions': [], @@ -1139,7 +1139,7 @@ class Requests: expected_parameters = ['entity_ids', 'entity_types', 'accept', 'attrs', 'context', 'geoproperty', 'options', 'limit', 'entity_id_pattern', - 'georel', 'coordinates', 'geometry', 'count' , 'q'] + 'scopeq', 'georel', 'coordinates', 'geometry', 'count' , 'q'] result = [x for x in kwargs if x not in expected_parameters] response = "Get Entities Request:" @@ -1164,6 +1164,8 @@ class Requests: response = f"{response} and\n Query Parameter: limit set to '{value}'" case 'entity_id_pattern': response = f"{response} and\n Query Parameter: entity_id_pattern set to '{value}'" + case 'scopeq': + response = f"{response} and\n Query Parameter: scopeq set to '{value}'" case 'georel': response = f"{response} and\n Query Parameter: georel set to '{value}'" case 'coordinates': diff --git a/doc/files/ContextInformation/Consumption/019_01_06.json b/doc/files/ContextInformation/Consumption/019_01_06.json new file mode 100644 index 00000000..e9bfc6b4 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_01_06.json @@ -0,0 +1,127 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "test_objective": "Check that you can query several entities based on scopes", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 4.19", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "4.19" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial Entities", + "Delete Entities" + ], + "teardown": "Delete Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_01_06 QueryWithFullScope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${2}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/Madrid/Gardens/ParqueNorte' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_01_06 QueryWithPlusMatching", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${2}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/Madrid/+/ParqueNorte' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_01_06 QueryWithHashMatching", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${1}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/CompanyA/#' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_01_06 QueryNonEmptyScope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${2}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/#' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_01_06 QueryWithAndScope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${1}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/Madrid/Gardens/ParqueNorte;/CompanyA/OrganizationB/UnitC' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_01_06 QueryWithOrScope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", + "doc": "Check that you can query several entities based on scopes", + "tags": [ + "4_19", + "e-query", + "since_v1.5.1" + ], + "setup": null, + "teardown": null, + "template": "Query several entities based on scopes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Response Body containing a list of entities equal to '${2}' of type 'https://ngsi-ld-test-suite/context#Building' with response set to '${response.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: scopeq set to '/Madrid/Gardens/ParqueNorte,/CompanyA/OrganizationB/UnitC' and\n Query Parameter: entity_types set to 'https://ngsi-ld-test-suite/context#Building'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_01_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/001_01.json b/doc/files/ContextInformation/Provision/001_01.json index 0bfc084d..c3f99fe3 100644 --- a/doc/files/ContextInformation/Provision/001_01.json +++ b/doc/files/ContextInformation/Provision/001_01.json @@ -26,8 +26,8 @@ "setup": null, "teardown": "Delete Initial Entity", "template": "Create Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-without-context-sample.jsonld'\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-sample.json'\n}", "http_verb": "POST", "endpoint": "entities/" }, diff --git a/doc/files/ContextInformation/Provision/001_02.json b/doc/files/ContextInformation/Provision/001_02.json index 81a53fb3..505fa379 100644 --- a/doc/files/ContextInformation/Provision/001_02.json +++ b/doc/files/ContextInformation/Provision/001_02.json @@ -58,7 +58,7 @@ "teardown": null, "template": "Create Entity With Invalid Request Scenarios", "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity From File with Response Status Code set to 400 and\n Create Entity From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Entity From File with Response body containing 'title' element\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request creation of an entity from filename 'building-minimal-without-context-sample.jsonld' and Content-Type set to 'application/ld+json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request creation of an entity from filename 'building-minimal-sample.json' and Content-Type set to 'application/ld+json'\n}", "http_verb": "POST", "endpoint": "entities/" } diff --git a/doc/files/ContextInformation/Provision/011_05.json b/doc/files/ContextInformation/Provision/011_05.json new file mode 100644 index 00000000..346082f6 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_05.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_05", + "test_objective": "Check that you can update a scope in an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clauses 4.18, 5.6.2", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "4.18", + "5.6.2" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_05_01 Update scope to an entity already having a scope", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_05_01", + "doc": "Check that scope is replaced if entity already has a scope", + "tags": [ + "4_18", + "5_6_2", + "ea-append", + "since_v1.5.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Update Entity Attributes with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/'\n method set to 'GET'\n Request Retrieve Entity by Id and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "" + }, + { + "name": "011_05_02 Update scope to an entity not having a scope", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_05_02", + "doc": "Check that scope is not added if entity does not already have a scope", + "tags": [ + "4_18", + "5_6_2", + "ea-append", + "since_v1.5.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 207 and\n Update Entity Attributes with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/'\n method set to 'GET'\n Request Retrieve Entity by Id and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/013_04.json b/doc/files/ContextInformation/Provision/013_04.json new file mode 100644 index 00000000..b31c80a9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/013_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_04", + "test_objective": "Check that you can delete a scope from an entity", + "reference": "ETSI GS CIM 009 V1.3.1 [], clauses 4.18, 5.6.5", + "config_id": "", + "parent_release": "v1.3.1", + "clauses": [ + "4.18", + "5.6.5" + ], + "pics_selection": "", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "013_04 Delete scope from an entity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_04", + "doc": "Check that you can delete a scope from an entity", + "tags": [ + "4_18", + "5_6_5", + "ea-delete", + "since_v1.5.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Delete Entity Attributes with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/'\n method set to 'GET'\n Request Retrieve Entity by Id and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json'\n}", + "http_verb": "GET", + "endpoint": "" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute", + "robotfile": "013_04" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py index a4ba1041..993590ca 100644 --- a/doc/tests/test_ContextInformation_Consumption.py +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -133,6 +133,13 @@ class TestCIConsumptions(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_019_01_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_01_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_01_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_019_02_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_02_01.json' diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index 8464f4c9..47ef03a8 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -350,6 +350,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_013_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_013_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_012_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_01.json' @@ -406,6 +413,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_011_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_007_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/007_01.json' diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 423fa366..8658f815 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -35,6 +35,7 @@ Query Entities ... ${options}=${EMPTY} ... ${limit}=${EMPTY} ... ${entity_id_pattern}=${EMPTY} + ... ${scopeq}=${EMPTY} ... ${georel}=${EMPTY} ... ${coordinates}=${EMPTY} ... ${geometry}=${EMPTY} @@ -72,6 +73,7 @@ Query Entities IF '${entity_id_pattern}'!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} END + IF '${scopeq}'!='' Set To Dictionary ${params} scopeQ=${scopeq} IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} IF '${coordinates}'!='' Set To Dictionary ${params} coordinates=${coordinates} -- GitLab From b5f4f7f9b8cbfb46fa7faccd6770a1594245246d Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 20 Mar 2024 13:40:32 +0100 Subject: [PATCH 2/4] fix(001_10): remove useless check on content type --- .../Provision/Entities/CreateEntity/001_11.robot | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot index 6873dd7c..46f0cb87 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot @@ -36,15 +36,7 @@ Create Entity Scenarios Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${entity_id} ${response.headers} ${created_entity}= Load Test Sample entities/${filename} ${entity_id} - IF '${content_type}'=='application/json' - ${response1}= Retrieve Entity by Id ${entity_id} ${content_type} - END - IF '${content_type}'=='application/ld+json' - ${response1}= Retrieve Entity by Id - ... ${entity_id} - ... ${content_type} - ... context=${ngsild_test_suite_context} - END + ${response1}= Retrieve Entity by Id ${entity_id} ${content_type} Check Created Resource Set To ${created_entity} ${response1.json()} Delete Initial Entity -- GitLab From f3dba39512459ab6582ab0e295971ce7cfb74f81 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 23 Mar 2024 09:51:46 +0100 Subject: [PATCH 3/4] chore: robotidy --- .../Consumption/Entity/QueryEntities/019_01_06.robot | 12 ++++++------ .../AppendEntityAttributes/010_07.robot | 4 ++-- .../DeleteEntityAttribute/013_04.robot | 2 +- .../UpdateEntityAttributes/011_05.robot | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot index 02781757..9dbfeffd 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_06.robot @@ -20,22 +20,22 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building *** Test Cases *** SCOPEQ EXPECTED_COUNT 019_01_06 QueryWithFullScope - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /Madrid/Gardens/ParqueNorte ${2} 019_01_06 QueryWithPlusMatching - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /Madrid/+/ParqueNorte ${2} 019_01_06 QueryWithHashMatching - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /CompanyA/# ${1} 019_01_06 QueryNonEmptyScope - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /# ${2} 019_01_06 QueryWithAndScope - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /Madrid/Gardens/ParqueNorte;/CompanyA/OrganizationB/UnitC ${1} 019_01_06 QueryWithOrScope - [Tags] e-query 4_19 since_v1.5.1 + [Tags] e-query 4_19 since_v1.5.1 /Madrid/Gardens/ParqueNorte,/CompanyA/OrganizationB/UnitC ${2} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot index 939ec05e..42d37efb 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot @@ -19,7 +19,7 @@ ${scope_fragment_filename}= one-scope-fragment.json *** Test Cases *** 010_07_01 Append scope to an entity with overwrite enabled [Documentation] Check that scope is replaced if overwrite is enabled - [Tags] ea-append 5_6_3 4_18 since_v1.5.1 + [Tags] ea-append 5_6_3 4_18 since_v1.5.1 ${response}= Append Entity Attributes ... ${entity_id} ... ${scope_fragment_filename} @@ -35,7 +35,7 @@ ${scope_fragment_filename}= one-scope-fragment.json 010_07_01 Append scope to an entity with overwrite disabled [Documentation] Check that scope is appended if overwrite is disabled - [Tags] ea-append 5_6_3 4_18 since_v1.5.1 + [Tags] ea-append 5_6_3 4_18 since_v1.5.1 ${response}= Append Entity Attributes With Parameters ... ${entity_id} ... ${scope_fragment_filename} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot index 94582d9d..a11d8d9a 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_04.robot @@ -19,7 +19,7 @@ ${expectation_filename}= building-minimal-compacted-expectation.json *** Test Cases *** 013_04 Delete scope from an entity [Documentation] Check that you can delete a scope from an entity - [Tags] ea-delete 5_6_5 4_18 since_v1.5.1 + [Tags] ea-delete 5_6_5 4_18 since_v1.5.1 ${response}= Delete Entity Attributes ... ${entity_id} ... scope diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot index 25914947..9f7f0f22 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_05.robot @@ -17,7 +17,7 @@ ${scope_fragment_filename}= one-scope-fragment.json *** Test Cases *** 011_05_01 Update scope to an entity already having a scope [Documentation] Check that scope is replaced if entity already has a scope - [Tags] ea-append 5_6_2 4_18 since_v1.5.1 + [Tags] ea-append 5_6_2 4_18 since_v1.5.1 [Setup] Create Initial Entity building-minimal-with-one-scope.json ${response}= Update Entity Attributes ... ${entity_id} @@ -34,7 +34,7 @@ ${scope_fragment_filename}= one-scope-fragment.json 011_05_02 Update scope to an entity not having a scope [Documentation] Check that scope is not added if entity does not already have a scope - [Tags] ea-append 5_6_2 4_18 since_v1.5.1 + [Tags] ea-append 5_6_2 4_18 since_v1.5.1 [Setup] Create Initial Entity building-minimal-sample.json ${response}= Update Entity Attributes ... ${entity_id} -- GitLab From a8f0d97bf4cfbb56b3818fd8eedc8da7e39d5d5d Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 23 Mar 2024 09:59:16 +0100 Subject: [PATCH 4/4] chore: update generated doc --- .../Consumption/019_01_06.json | 5 +- .../ContextInformation/Provision/001_01.json | 2 +- .../ContextInformation/Provision/001_11.json | 58 ++++++++++++++++++ .../ContextInformation/Provision/010_07.json | 61 +++++++++++++++++++ .../ContextInformation/Provision/011_05.json | 9 ++- .../ContextInformation/Provision/013_04.json | 9 ++- .../test_ContextInformation_Provision.py | 14 +++++ 7 files changed, 149 insertions(+), 9 deletions(-) create mode 100644 doc/files/ContextInformation/Provision/001_11.json create mode 100644 doc/files/ContextInformation/Provision/010_07.json diff --git a/doc/files/ContextInformation/Consumption/019_01_06.json b/doc/files/ContextInformation/Consumption/019_01_06.json index e9bfc6b4..3a654cf5 100644 --- a/doc/files/ContextInformation/Consumption/019_01_06.json +++ b/doc/files/ContextInformation/Consumption/019_01_06.json @@ -1,14 +1,15 @@ { "tp_id": "TP/NGSI-LD/CI/Cons/E/019_01_06", "test_objective": "Check that you can query several entities based on scopes", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 4.19", + "reference": "ETSI GS CIM 009 V1.5.1 [], clause 4.19", "config_id": "", - "parent_release": "v1.3.1", + "parent_release": "v1.5.1", "clauses": [ "4.19" ], "pics_selection": "", "keywords": [ + "Query several entities based on scopes", "Setup Initial Entities", "Delete Entities" ], diff --git a/doc/files/ContextInformation/Provision/001_01.json b/doc/files/ContextInformation/Provision/001_01.json index c3f99fe3..a89bba4a 100644 --- a/doc/files/ContextInformation/Provision/001_01.json +++ b/doc/files/ContextInformation/Provision/001_01.json @@ -26,7 +26,7 @@ "setup": null, "teardown": "Delete Initial Entity", "template": "Create Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}'\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'created_resource' set to 'created_entity' and\n Query Parameter: 'response_body' set to 'response1.json()' and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-sample.json'\n}", "http_verb": "POST", "endpoint": "entities/" diff --git a/doc/files/ContextInformation/Provision/001_11.json b/doc/files/ContextInformation/Provision/001_11.json new file mode 100644 index 00000000..df0d9bb9 --- /dev/null +++ b/doc/files/ContextInformation/Provision/001_11.json @@ -0,0 +1,58 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/001_11", + "test_objective": "Check that you can create an entity with one or more scopes", + "reference": "ETSI GS CIM 009 V1.5.1 [], clause 4.18", + "config_id": "", + "parent_release": "v1.5.1", + "clauses": [ + "4.18" + ], + "pics_selection": "", + "keywords": [ + "Create Entity Scenarios", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "001_11_01 EntityWithOneScope", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_11_01", + "doc": "Check that you can create an entity with one or more scopes", + "tags": [ + "4_18", + "e-create", + "since_v1.5.1" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-with-one-scope.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + }, + { + "name": "001_11_02 EntityWithManyScopes", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/001_11_02", + "doc": "Check that you can create an entity with one or more scopes", + "tags": [ + "4_18", + "e-create", + "since_v1.5.1" + ], + "setup": null, + "teardown": "Delete Initial Entity", + "template": "Create Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Create Entity Selecting Content Type with Response Header: Location containing $${entity_id} and\n Retrieve Entity by Id with Check Created Resource Set To and\n Query Parameter: 'ignored_keys' set to '${None}' list of keys\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'POST'\n Request Header['Content-Type'] set to 'application/json' and\n payload defined in file: 'building-minimal-with-many-scopes.json'\n}", + "http_verb": "POST", + "endpoint": "entities/" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/CreateEntity", + "robotfile": "001_11" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/010_07.json b/doc/files/ContextInformation/Provision/010_07.json new file mode 100644 index 00000000..340660ee --- /dev/null +++ b/doc/files/ContextInformation/Provision/010_07.json @@ -0,0 +1,61 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/010_07", + "test_objective": "Check that you can append a scope to an entity", + "reference": "ETSI GS CIM 009 V1.5.1 [], clauses 4.18, 5.6.3", + "config_id": "", + "parent_release": "v1.5.1", + "clauses": [ + "4.18", + "5.6.3" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "010_07_01 Append scope to an entity with overwrite enabled", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_07_01", + "doc": "Check that scope is replaced if overwrite is enabled", + "tags": [ + "4_18", + "5_6_3", + "ea-append", + "since_v1.5.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes with Response Status Code set to 204 and\n Append Entity Attributes with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/'\n method set to 'GET'\n Request Retrieve Entity by Id and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "" + }, + { + "name": "010_07_01 Append scope to an entity with overwrite disabled", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/010_07_01", + "doc": "Check that scope is appended if overwrite is disabled", + "tags": [ + "4_18", + "5_6_3", + "ea-append", + "since_v1.5.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Initial Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Append Entity Attributes With Parameters with Response Status Code set to 204 and\n Append Entity Attributes With Parameters with Updated Entity set to ${entity}\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/'\n method set to 'GET'\n Request Retrieve Entity by Id and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: accept set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "GET", + "endpoint": "" + } + ], + "permutations": [ + "then" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/AppendEntityAttributes", + "robotfile": "010_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_05.json b/doc/files/ContextInformation/Provision/011_05.json index 346082f6..9052f782 100644 --- a/doc/files/ContextInformation/Provision/011_05.json +++ b/doc/files/ContextInformation/Provision/011_05.json @@ -1,15 +1,18 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_05", "test_objective": "Check that you can update a scope in an entity", - "reference": "ETSI GS CIM 009 V1.3.1 [], clauses 4.18, 5.6.2", + "reference": "ETSI GS CIM 009 V1.5.1 [], clauses 4.18, 5.6.2", "config_id": "", - "parent_release": "v1.3.1", + "parent_release": "v1.5.1", "clauses": [ "4.18", "5.6.2" ], "pics_selection": "", - "keywords": [], + "keywords": [ + "Create Initial Entity", + "Delete Initial Entity" + ], "teardown": "None", "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ diff --git a/doc/files/ContextInformation/Provision/013_04.json b/doc/files/ContextInformation/Provision/013_04.json index b31c80a9..48a71b19 100644 --- a/doc/files/ContextInformation/Provision/013_04.json +++ b/doc/files/ContextInformation/Provision/013_04.json @@ -1,15 +1,18 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_04", "test_objective": "Check that you can delete a scope from an entity", - "reference": "ETSI GS CIM 009 V1.3.1 [], clauses 4.18, 5.6.5", + "reference": "ETSI GS CIM 009 V1.5.1 [], clauses 4.18, 5.6.5", "config_id": "", - "parent_release": "v1.3.1", + "parent_release": "v1.5.1", "clauses": [ "4.18", "5.6.5" ], "pics_selection": "", - "keywords": [], + "keywords": [ + "Create Initial Entity", + "Delete Initial Entity" + ], "teardown": "None", "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index 47ef03a8..36f34dba 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -266,6 +266,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_001_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_001_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_002_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/002_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/002_01.json' @@ -329,6 +336,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_010_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_010_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_013_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/013_01.json' -- GitLab