diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot index bbf48311c4327ccb14899d5da3dc7397113551ae..1467b72e200a16c9bb65b6a7a7ee21b2a3f77fbf 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_02.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one cannot query entities if the requested entity types are incorrect +Documentation Check that one cannot query entities if the requested id pattern is incorrect Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -12,22 +12,20 @@ Suite Teardown Delete Entities *** Variables *** -${building_filename}= building-minimal.jsonld -${vehicle_filename}= vehicle-simple-attributes.jsonld -${invalid_entity_type_one}= type -${invalid_entity_type_two}= invalid_entity_type_two +${filename}= building-minimal.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${invalid_entity_id_pattern}= invalid_entity_id_pattern** *** Test Cases *** -019_03_02 Query entities based on incorrect entity types - [Documentation] Check that one cannot query entities if the requested entity types are incorrect +019_03_02 Query several entities based on incorrect id pattern + [Documentation] Check that one cannot query entities if the requested id pattern is incorrect [Tags] e-query 5_7_2 - ${entity_types_to_be_retrieved}= Catenate - ... SEPARATOR=, - ... ${invalid_entity_type_one} - ... ${invalid_entity_type_two} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} + ${response}= Query Entities + ... entity_id_pattern=${invalid_entity_id_pattern} + ... entity_types=${entity_types_to_be_retrieved} Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to @@ -38,21 +36,21 @@ ${invalid_entity_type_two}= invalid_entity_type_two *** Keywords *** Create Entities - ${building_entity_id}= Generate Random Building Entity Id - Set Suite Variable ${building_entity_id} + ${first_entity_id}= Generate Random Building Entity Id + Set Suite Variable ${first_entity_id} ${create_response1}= Create Entity Selecting Content Type - ... ${building_filename} - ... ${building_entity_id} + ... ${filename} + ... ${first_entity_id} ... ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${create_response1.status_code} - ${vehicle_entity_id}= Generate Random Vehicle Entity Id - Set Suite Variable ${vehicle_entity_id} + ${second_entity_id}= Generate Random Building Entity Id + Set Suite Variable ${second_entity_id} ${create_response2}= Create Entity Selecting Content Type - ... ${vehicle_filename} - ... ${vehicle_entity_id} + ... ${filename} + ... ${second_entity_id} ... ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${create_response2.status_code} Delete Entities - Delete Entity by Id ${building_entity_id} - Delete Entity by Id ${vehicle_entity_id} + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot index 6dc83085ad31bbd93d7fa7c25bbf35110da918c0..3311f47d51f510245c53ca0b74797ca8aa449939 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one cannot query entities if the requested id pattern is incorrect +Documentation Check that one cannot query entities if the requested attribute names are incorrect Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -12,20 +12,19 @@ Suite Teardown Delete Entities *** Variables *** -${filename}= building-minimal.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building -${invalid_entity_id_pattern}= invalid_entity_id_pattern** +${filename}= building-minimal.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${invalid_attribute_one}= id +${invalid_attribute_two}= type *** Test Cases *** -019_03_03 Query several entities based on incorrect id pattern - [Documentation] Check that one cannot query entities if the requested id pattern is incorrect +019_03_03 Query several entities based on incorrect attribute names + [Documentation] Check that one cannot query entities if the requested attribute names are incorrect [Tags] e-query 5_7_2 - ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${invalid_attribute_one} ${invalid_attribute_two} - ${response}= Query Entities - ... entity_id_pattern=${invalid_entity_id_pattern} - ... entity_types=${entity_types_to_be_retrieved} + ${response}= Query Entities attrs=${attributes_to_be_retrieved} Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot index 1b13c2343b460d5e2cd4ff8075ddbed4ae4fbcfe..daffe17ea283636137a3f850f8fb3a824d326af3 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_04.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one cannot query entities if the requested attribute names are incorrect +Documentation Check that one cannot query entities if the request has a wrong geometryProperty Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -12,19 +12,27 @@ Suite Teardown Delete Entities *** Variables *** -${filename}= building-minimal.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building -${invalid_attribute_one}= id -${invalid_attribute_two}= type +${filename}= building-location-attribute.jsonld +${entity_type}= Building +${georel}= invalid +${geometry}= Point +${coordinates}= [-8.503,41.202] +${geoproperty}= location *** Test Cases *** -019_03_04 Query several entities based on incorrect attribute names - [Documentation] Check that one cannot query entities if the requested attribute names are incorrect +019_03_04 Query entities when the request has a wrong geometryProperty + [Documentation] Check that one cannot query entities if the request has a wrong geometryProperty [Tags] e-query 5_7_2 - ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${invalid_attribute_one} ${invalid_attribute_two} - - ${response}= Query Entities attrs=${attributes_to_be_retrieved} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} + + ${response}= Query Entities + ... entity_types=${entity_types_to_be_retrieved} + ... geoproperty=${geoproperty} + ... georel=${georel} + ... geometry=${geometry} + ... coordinates=${coordinates} + ... context=${ngsild_test_suite_context} Check Response Status Code 400 ${response.status_code} Check Response Body Containing ProblemDetails Element Containing Type Element set to diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot deleted file mode 100644 index 25eef745fb3b5ae9e1c74c5b820fd2bdebc53afe..0000000000000000000000000000000000000000 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot +++ /dev/null @@ -1,63 +0,0 @@ -*** Settings *** -Documentation Check that one cannot query entities if the request has a wrong geometryProperty - -Resource ${EXECDIR}/resources/ApiUtils/Common.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -Suite Setup Create Entities -Suite Teardown Delete Entities - - -*** Variables *** -${filename}= building-location-attribute.jsonld -${entity_type}= Building -${georel}= invalid -${geometry}= Point -${coordinates}= [-8.503,41.202] -${geoproperty}= location - - -*** Test Cases *** -019_03_05 Query entities when the request has a wrong geometryProperty - [Documentation] Check that one cannot query entities if the request has a wrong geometryProperty - [Tags] e-query 5_7_2 - ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - - ${response}= Query Entities - ... entity_types=${entity_types_to_be_retrieved} - ... geoproperty=${geoproperty} - ... georel=${georel} - ... geometry=${geometry} - ... coordinates=${coordinates} - ... context=${ngsild_test_suite_context} - - Check Response Status Code 400 ${response.status_code} - Check Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${ERROR_TYPE_BAD_REQUEST_DATA} - Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} - - -*** Keywords *** -Create Entities - ${first_entity_id}= Generate Random Building Entity Id - Set Suite Variable ${first_entity_id} - ${create_response1}= Create Entity Selecting Content Type - ... ${filename} - ... ${first_entity_id} - ... ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${create_response1.status_code} - ${second_entity_id}= Generate Random Building Entity Id - Set Suite Variable ${second_entity_id} - ${create_response2}= Create Entity Selecting Content Type - ... ${filename} - ... ${second_entity_id} - ... ${CONTENT_TYPE_LD_JSON} - Check Response Status Code 201 ${create_response2.status_code} - -Delete Entities - Delete Entity by Id ${first_entity_id} - Delete Entity by Id ${second_entity_id} 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 5602f3749e9f7777d626a5902a7712c6eb00b712..a9d3a691eaf2530d62a1c1afebbb9670064c8145 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -17,6 +17,9 @@ Test Template Create Entity With Invalid Request Scenarios 001_02_03 EntityWithNoContext [Tags] e-create 5_6_1 building-minimal.json ${ERROR_TYPE_BAD_REQUEST_DATA} +001_02_04 EntityWithNoContext + [Tags] e-create 5_6_1 + invalid-type.jsonld ${ERROR_TYPE_INVALID_REQUEST} *** Keywords *** diff --git a/data/entities/invalid-type.jsonld b/data/entities/invalid-type.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..0f76d0ddd00ad775899080e407682e8099c398c9 --- /dev/null +++ b/data/entities/invalid-type.jsonld @@ -0,0 +1,7 @@ +{ + "id":"urn:ngsi-ld:Building:randomUUID", + "type":"type", + "@context":[ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" + ] +} diff --git a/doc/files/ContextInformation/Consumption/019_03_02.json b/doc/files/ContextInformation/Consumption/019_03_02.json index 17b5464c9a25efc939c5205609e74ccd01e13d90..9f8b735a9131f18c14ebabe56493dfabb45b3c4d 100644 --- a/doc/files/ContextInformation/Consumption/019_03_02.json +++ b/doc/files/ContextInformation/Consumption/019_03_02.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_02", - "test_objective": "Check that you cannot query entities if the requested entity types are incorrect", + "test_objective": "Check that you cannot query entities if the requested id pattern is incorrect", "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", "config_id": "", "parent_release": "v1.3.1", @@ -15,9 +15,9 @@ "initial_condition": "with {\n the SUT containing an initial state\n}", "test_cases": [ { - "name": "019_03_02 Query entities based on incorrect entity types", + "name": "019_03_02 Query several entities based on incorrect id pattern", "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_02", - "doc": "Check that you cannot query entities if the requested entity types are incorrect", + "doc": "Check that you cannot query entities if the requested id pattern is incorrect", "tags": [ "5_7_2", "e-query" @@ -26,7 +26,7 @@ "teardown": null, "template": null, "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 Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities 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 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\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: entity_id_pattern set to 'invalid_entity_id_pattern**' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\n}", "http_verb": "GET", "endpoint": "entities/" } diff --git a/doc/files/ContextInformation/Consumption/019_03_03.json b/doc/files/ContextInformation/Consumption/019_03_03.json index 3dfa22fe513abb7cf9c70749ee68285aa449d2b2..f22d4291e903a1b3468773dec7139b750728ad59 100644 --- a/doc/files/ContextInformation/Consumption/019_03_03.json +++ b/doc/files/ContextInformation/Consumption/019_03_03.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_03", - "test_objective": "Check that you cannot query entities if the requested id pattern is incorrect", + "test_objective": "Check that you cannot query entities if the requested attribute names are incorrect", "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", "config_id": "", "parent_release": "v1.3.1", @@ -15,9 +15,9 @@ "initial_condition": "with {\n the SUT containing an initial state\n}", "test_cases": [ { - "name": "019_03_03 Query several entities based on incorrect id pattern", + "name": "019_03_03 Query several entities based on incorrect attribute names", "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_03", - "doc": "Check that you cannot query entities if the requested id pattern is incorrect", + "doc": "Check that you cannot query entities if the requested attribute names are incorrect", "tags": [ "5_7_2", "e-query" @@ -26,7 +26,7 @@ "teardown": null, "template": null, "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 Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities 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 'GET'\n Get Entities Request: and\n Query Parameter: entity_id_pattern set to 'invalid_entity_id_pattern**' and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}'\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: attrs set to '${attributes_to_be_retrieved}'\n}", "http_verb": "GET", "endpoint": "entities/" } diff --git a/doc/files/ContextInformation/Consumption/019_03_04.json b/doc/files/ContextInformation/Consumption/019_03_04.json index 0d3ed4405f80c7ccce0792685812e4320994ca39..d5f5abe49265ac56514ebbecb4ffc36ab026b3e6 100644 --- a/doc/files/ContextInformation/Consumption/019_03_04.json +++ b/doc/files/ContextInformation/Consumption/019_03_04.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_04", - "test_objective": "Check that you cannot query entities if the requested attribute names are incorrect", + "test_objective": "Check that you cannot query entities if the request has a wrong geometryProperty", "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", "config_id": "", "parent_release": "v1.3.1", @@ -15,9 +15,9 @@ "initial_condition": "with {\n the SUT containing an initial state\n}", "test_cases": [ { - "name": "019_03_04 Query several entities based on incorrect attribute names", + "name": "019_03_04 Query entities when the request has a wrong geometryProperty", "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_04", - "doc": "Check that you cannot query entities if the requested attribute names are incorrect", + "doc": "Check that you cannot query entities if the request has a wrong geometryProperty", "tags": [ "5_7_2", "e-query" @@ -26,7 +26,7 @@ "teardown": null, "template": null, "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 Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities 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 'GET'\n Get Entities Request: and\n Query Parameter: attrs set to '${attributes_to_be_retrieved}'\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: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: geoproperty set to 'location' and\n Query Parameter: georel set to 'invalid' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[-8.503,41.202]' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", "http_verb": "GET", "endpoint": "entities/" } diff --git a/doc/files/ContextInformation/Consumption/019_03_05.json b/doc/files/ContextInformation/Consumption/019_03_05.json deleted file mode 100644 index 477b5a8dfbe300fdcc7f766be5eac0172a26728f..0000000000000000000000000000000000000000 --- a/doc/files/ContextInformation/Consumption/019_03_05.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_05", - "test_objective": "Check that you cannot query entities if the request has a wrong geometryProperty", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.2", - "config_id": "", - "parent_release": "v1.3.1", - "clauses": [ - "5.7.2" - ], - "pics_selection": "", - "keywords": [ - "Delete Entities" - ], - "teardown": "Delete Entities", - "initial_condition": "with {\n the SUT containing an initial state\n}", - "test_cases": [ - { - "name": "019_03_05 Query entities when the request has a wrong geometryProperty", - "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_03_05", - "doc": "Check that you cannot query entities if the request has a wrong geometryProperty", - "tags": [ - "5_7_2", - "e-query" - ], - "setup": null, - "teardown": null, - "template": null, - "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 Status Code set to 201 and\n Query Entities with Response Status Code set to 400 and\n Query Entities with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Query Entities 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 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n Query Parameter: geoproperty set to 'location' and\n Query Parameter: georel set to 'invalid' and\n Query Parameter: geometry set to 'Point' and\n Query Parameter: coordinates set to '[-8.503,41.202]' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", - "http_verb": "GET", - "endpoint": "entities/" - } - ], - "permutations": [], - "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", - "robotfile": "019_03_05" -} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py index a2de70689035f848e1e13bfcc38f4e111b91f577..a216a21f1820821e3b0c1ff2c9647aed1a5774f1 100644 --- a/doc/tests/test_ContextInformation_Consumption.py +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -210,13 +210,6 @@ class TestCIConsumptions(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_019_03_05(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_05.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_03_05.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_019_03_05.json' - - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_019_04(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_04.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_04.json'