From 5f74b3a412fc33e182beb009b8703168818ece2d Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 4 Mar 2024 14:30:18 +0100 Subject: [PATCH 1/8] test case : return the total number of matching results if count is set to true --- .../Entity/QueryEntities/019_07.robot | 58 +++++++++++++++++++ ...ing-simple-attributes-second-sample.jsonld | 25 ++++++++ .../ContextInformationConsumption.resource | 4 ++ resources/AssertionUtils.resource | 4 ++ 4 files changed, 91 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot create mode 100644 data/entities/building-simple-attributes-second-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot new file mode 100644 index 00000000..6e690181 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Suite Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${first_entity_filename}= building-simple-attributes-sample.jsonld +${second_entity_filename}= building-simple-attributes-second-sample.jsonld +${entity_type}= https://ngsi-ld-test-suite/context#Building +${airQualityLevel}= https://ngsi-ld-test-suite/context#airQualityLevel==6 + + +*** Test Cases *** +019_07_01 Check that the total number of matching results is returned if the count parameter is set to true. + [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. + [Tags] e-query 6_3_13 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${create_response1}= Create Entity Selecting Content Type + ... ${first_entity_filename} + ... ${first_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response1.status_code} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... ${second_entity_filename} + ... ${second_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + + ${response}= Query Entities + ... entity_types=${entity_type} + ... count=${True} + + Check Response Status Code 200 ${response.status_code} + + Check Response Headers Containing NGSILD-Results-Count 2 ${response.headers} + ${response}= Query Entities + ... entity_types=${entity_type} + ... q=${airQualityLevel} + ... count=${True} + + Check Response Status Code 200 ${response.status_code} + Check Response Headers Containing NGSILD-Results-Count 1 ${response.headers} + + +*** Keywords *** +Delete Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${second_entity_id} diff --git a/data/entities/building-simple-attributes-second-sample.jsonld b/data/entities/building-simple-attributes-second-sample.jsonld new file mode 100644 index 00000000..a79af10e --- /dev/null +++ b/data/entities/building-simple-attributes-second-sample.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Pisa Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 6, + "unitCode": "C62", + "observedAt": "2020-10-10T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": true + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 0fbad1d8..6f3d9d02 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -38,6 +38,8 @@ Query Entities ... ${georel}=${EMPTY} ... ${coordinates}=${EMPTY} ... ${geometry}=${EMPTY} + ... ${count}=${EMPTY} + ... ${q}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${accept_length}= Get Length ${accept} ${options_length}= Get Length ${options} @@ -77,6 +79,8 @@ Query Entities IF '${geometry}'!='' Set To Dictionary ${params} geometry=${geometry} END + IF '${count}'!='' Set To Dictionary ${params} count=${count} + IF '${q}'!='' Set To Dictionary ${params} q=${q} ${response}= GET ... url=${url}/${ENTITIES_ENDPOINT_PATH} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index f288c8a8..2c2920b5 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -60,6 +60,10 @@ Check Response Headers Containing URI set to ... ignore_order=True END +Check Response Headers Containing NGSILD-Results-Count + [Arguments] ${expected_result_count} ${response_headers} + Should Be Equal ${response_headers['NGSILD-Results-Count']} ${expected_result_count} + # Since Http headers names are case-insensitive (from Http specification) # We check both Location and location headers -- GitLab From b8d76e4ec9ec1f09c1bbc0a39e10b9ca306e5937 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 4 Mar 2024 18:19:41 +0100 Subject: [PATCH 2/8] changed query entity method to add the context --- .../Consumption/Entity/QueryEntities/019_07.robot | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index 6e690181..818a7e0f 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -13,8 +13,9 @@ Suite Teardown Delete Entities ${building_id_prefix}= urn:ngsi-ld:Building: ${first_entity_filename}= building-simple-attributes-sample.jsonld ${second_entity_filename}= building-simple-attributes-second-sample.jsonld -${entity_type}= https://ngsi-ld-test-suite/context#Building -${airQualityLevel}= https://ngsi-ld-test-suite/context#airQualityLevel==6 +${entity_type}= Building +${airQualityLevel}= airQualityLevel==6 +${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld *** Test Cases *** @@ -39,6 +40,7 @@ ${airQualityLevel}= https://ngsi-ld-test-suite/context#airQualityLev ${response}= Query Entities ... entity_types=${entity_type} ... count=${True} + ... context=${context} Check Response Status Code 200 ${response.status_code} @@ -47,6 +49,7 @@ ${airQualityLevel}= https://ngsi-ld-test-suite/context#airQualityLev ... entity_types=${entity_type} ... q=${airQualityLevel} ... count=${True} + ... context=${context} Check Response Status Code 200 ${response.status_code} Check Response Headers Containing NGSILD-Results-Count 1 ${response.headers} -- GitLab From 5309fb9e835c4ba0b13e09ff19de61ad5d4ea85e Mon Sep 17 00:00:00 2001 From: ranim-n Date: Tue, 5 Mar 2024 11:37:06 +0100 Subject: [PATCH 3/8] added permutation and suite setup --- .../Entity/QueryEntities/019_07.robot | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index 818a7e0f..289f737c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -6,7 +6,9 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption. Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource +Suite Setup Setup Entities Suite Teardown Delete Entities +Test Template Check that the total number of matching results is returned if the count parameter is set to true *** Variables *** @@ -18,10 +20,28 @@ ${airQualityLevel}= airQualityLevel==6 ${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld -*** Test Cases *** -019_07_01 Check that the total number of matching results is returned if the count parameter is set to true. +*** Test Cases *** Q_PARAMETER EXPECTED_STATUS EXPECTED_COUNT +019_07_01 Check that the total number of matching results is returned if the count parameter is set to true and only the entity type is provided + ${EMPTY} 200 2 +019_07_02 Check that the total number of matching results is returned if the count parameter is set to true and a q parameter is provided + ${airQualityLevel} 200 1 + + +*** Keywords *** +Check that the total number of matching results is returned if the count parameter is set to true [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. [Tags] e-query 6_3_13 + [Arguments] ${q} ${expected_status_code} ${expected_count} + ${response}= Query Entities + ... entity_types=${entity_type} + ... q=${q} + ... count=${True} + ... context=${context} + + Check Response Status Code ${expected_status_code} ${response.status_code} + Check Response Headers Containing NGSILD-Results-Count ${expected_count} ${response.headers} + +Setup Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} Set Suite Variable ${first_entity_id} ${create_response1}= Create Entity Selecting Content Type @@ -37,25 +57,6 @@ ${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suit ... ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${create_response2.status_code} - ${response}= Query Entities - ... entity_types=${entity_type} - ... count=${True} - ... context=${context} - - Check Response Status Code 200 ${response.status_code} - - Check Response Headers Containing NGSILD-Results-Count 2 ${response.headers} - ${response}= Query Entities - ... entity_types=${entity_type} - ... q=${airQualityLevel} - ... count=${True} - ... context=${context} - - Check Response Status Code 200 ${response.status_code} - Check Response Headers Containing NGSILD-Results-Count 1 ${response.headers} - - -*** Keywords *** Delete Entities Delete Entity by Id ${first_entity_id} Delete Entity by Id ${second_entity_id} -- GitLab From a2ddcc6183042c4699e230514a2dcc5ecbbbda40 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Tue, 5 Mar 2024 14:48:38 +0100 Subject: [PATCH 4/8] added another tag, used the global context variable and added test case to the file generating the doc --- .../Consumption/Entity/QueryEntities/019_07.robot | 5 ++--- doc/analysis/initial_setup.py | 1 + doc/analysis/requests.py | 2 +- doc/tests/test_ContextInformation_Consumption.py | 7 +++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index 289f737c..c5a8d4c3 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -17,7 +17,6 @@ ${first_entity_filename}= building-simple-attributes-sample.jsonld ${second_entity_filename}= building-simple-attributes-second-sample.jsonld ${entity_type}= Building ${airQualityLevel}= airQualityLevel==6 -${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld *** Test Cases *** Q_PARAMETER EXPECTED_STATUS EXPECTED_COUNT @@ -30,13 +29,13 @@ ${context}= https://forge.etsi.org/rep/cim/ngsi-ld-test-suit *** Keywords *** Check that the total number of matching results is returned if the count parameter is set to true [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. - [Tags] e-query 6_3_13 + [Tags] e-query 5_7_2 6_3_13 [Arguments] ${q} ${expected_status_code} ${expected_count} ${response}= Query Entities ... entity_types=${entity_type} ... q=${q} ... count=${True} - ... context=${context} + ... context=${ngsild_test_suite_context} Check Response Status Code ${expected_status_code} ${response.status_code} Check Response Headers Containing NGSILD-Results-Count ${expected_count} ${response.headers} diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 0ac02753..604eba0b 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -31,6 +31,7 @@ class InitialSetup: 'Setup Initial Context Source Registration Subscription': InitialSetup.init_csr_sub(), 'Setup Initial Context Source Registration Subscriptions': InitialSetup.init_csr_subs(), 'Create Initial Context Source Registration and Mock Server': InitialSetup.init_csr_and_server(), + 'Setup Entities' : InitialSetup.init_entities(), } self.total_files = -1 diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 96f2933c..13df0b48 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'] + 'georel', 'coordinates', 'geometry', 'count', 'q'] }, 'Query Entities Via POST': { 'positions': [], diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py index 8f059be8..1e9fddf9 100644 --- a/doc/tests/test_ContextInformation_Consumption.py +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -224,6 +224,13 @@ class TestCIConsumptions(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_019_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_018_01_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_01_01.json' -- GitLab From cd470eb3d04a3a992c9e16e2a0119279ae491dff Mon Sep 17 00:00:00 2001 From: ranim-n Date: Tue, 5 Mar 2024 17:16:35 +0100 Subject: [PATCH 5/8] added new test case to other documentation generating files --- .../Entity/QueryEntities/019_07.robot | 10 +++++----- doc/analysis/checks.py | 18 +++++++++++++++++- doc/analysis/initial_setup.py | 1 - doc/analysis/requests.py | 8 +++++--- resources/AssertionUtils.resource | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index c5a8d4c3..ad85bfbd 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -6,8 +6,8 @@ Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption. Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Setup Entities -Suite Teardown Delete Entities +Suite Setup Setup Initial Entities +Suite Teardown Delete Initial Entities Test Template Check that the total number of matching results is returned if the count parameter is set to true @@ -38,9 +38,9 @@ Check that the total number of matching results is returned if the count paramet ... context=${ngsild_test_suite_context} Check Response Status Code ${expected_status_code} ${response.status_code} - Check Response Headers Containing NGSILD-Results-Count ${expected_count} ${response.headers} + Check Response Headers Containing NGSILD-Results-Count Equals To ${expected_count} ${response.headers} -Setup Entities +Setup Initial Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} Set Suite Variable ${first_entity_id} ${create_response1}= Create Entity Selecting Content Type @@ -56,6 +56,6 @@ Setup Entities ... ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${create_response2.status_code} -Delete Entities +Delete Initial Entities Delete Entity by Id ${first_entity_id} Delete Entity by Id ${second_entity_id} diff --git a/doc/analysis/checks.py b/doc/analysis/checks.py index f65242bf..ebd47b5b 100644 --- a/doc/analysis/checks.py +++ b/doc/analysis/checks.py @@ -105,7 +105,9 @@ class Checks: 'Check Response Reason set to': Checks.check_response_reason_set_to, 'Check Response Does Not Contain Body': - Checks.check_response_does_not_contain_body + Checks.check_response_does_not_contain_body, + 'Check Response Headers Containing NGSILD-Results-Count Equals To' : + Checks.check_response_header_contains_ngsild_results_count_equals_to, } self.args = { @@ -303,6 +305,11 @@ class Checks: 'params': ['response'], 'position': [0] } + , + 'Check Response Headers Containing NGSILD-Results-Count Equals To': { + 'params': ['expected_result_count' , 'response_headers'], + 'position': [0, 1] + } } @staticmethod @@ -871,6 +878,14 @@ class Checks: else: raise Exception(f"ERROR, Expected 'expected_value' and 'obtained_value' parameters but received: '{kwargs}'") + @staticmethod + def check_response_header_contains_ngsild_results_count_equals_to(kwargs: list) -> str: + if "ngsild_results_count" in kwargs: + ngsild_results_count = kwargs['ngsild_results_count'] + return f'Response Header: NGSILD-Results-Count equals to {ngsild_results_count}' + else: + raise Exception(f'ERROR, Expected ngsild_results_count but received: {kwargs}') + def get_checks(self, **kwargs) -> str: checking = None @@ -977,6 +992,7 @@ if __name__ == "__main__": 'Check Created Resources Set To'] , status_code=201)) print() + print(data.get_checks(checks='Check Response Headers Containing NGSILD-Results-Count Equals To')) # Check exceptions try: diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 604eba0b..0ac02753 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -31,7 +31,6 @@ class InitialSetup: 'Setup Initial Context Source Registration Subscription': InitialSetup.init_csr_sub(), 'Setup Initial Context Source Registration Subscriptions': InitialSetup.init_csr_subs(), 'Create Initial Context Source Registration and Mock Server': InitialSetup.init_csr_and_server(), - 'Setup Entities' : InitialSetup.init_entities(), } self.total_files = -1 diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 13df0b48..ee11a0a0 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -1131,7 +1131,7 @@ class Requests: expected_parameters = ['entity_ids', 'entity_types', 'accept', 'attrs', 'context', 'geoproperty', 'options', 'limit', 'entity_id_pattern', - 'georel', 'coordinates', 'geometry'] + 'georel', 'coordinates', 'geometry', 'count' , 'q'] result = [x for x in kwargs if x not in expected_parameters] response = "Get Entities Request:" @@ -1160,8 +1160,10 @@ class Requests: response = f"{response} and\n Query Parameter: georel set to '{value}'" case 'coordinates': response = f"{response} and\n Query Parameter: coordinates set to '{value}'" - case 'geometry': - response = f"{response} and\n Query Parameter: geometry set to '{value}'" + case 'count': + response = f"{response} and\n Query Parameter: count set to '{value}'" + case 'q': + response = f"{response} and\n Query Parameter: q set to '{value}'" case _: raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " f"'{expected_parameters}', but received: {kwargs}") diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 2c2920b5..91ef5da9 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -60,7 +60,7 @@ Check Response Headers Containing URI set to ... ignore_order=True END -Check Response Headers Containing NGSILD-Results-Count +Check Response Headers Containing NGSILD-Results-Count Equals To [Arguments] ${expected_result_count} ${response_headers} Should Be Equal ${response_headers['NGSILD-Results-Count']} ${expected_result_count} -- GitLab From 5b6a037e60eac48174494026d7d551fdb6c9315c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 6 Mar 2024 13:52:07 +0100 Subject: [PATCH 6/8] fix: declarations for generation of the documentation --- .../Consumption/Entity/QueryEntities/019_07.robot | 4 ++-- doc/analysis/checks.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot index ad85bfbd..73484e24 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_07.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities Suite Teardown Delete Initial Entities -Test Template Check that the total number of matching results is returned if the count parameter is set to true +Test Template Query Entities With Count *** Variables *** @@ -27,7 +27,7 @@ ${airQualityLevel}= airQualityLevel==6 *** Keywords *** -Check that the total number of matching results is returned if the count parameter is set to true +Query Entities With Count [Documentation] If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results. [Tags] e-query 5_7_2 6_3_13 [Arguments] ${q} ${expected_status_code} ${expected_count} diff --git a/doc/analysis/checks.py b/doc/analysis/checks.py index ebd47b5b..70b7a570 100644 --- a/doc/analysis/checks.py +++ b/doc/analysis/checks.py @@ -880,11 +880,11 @@ class Checks: @staticmethod def check_response_header_contains_ngsild_results_count_equals_to(kwargs: list) -> str: - if "ngsild_results_count" in kwargs: - ngsild_results_count = kwargs['ngsild_results_count'] - return f'Response Header: NGSILD-Results-Count equals to {ngsild_results_count}' + if 'expected_result_count' in kwargs: + expected_result_count = kwargs['expected_result_count'] + return f'Response Header: NGSILD-Results-Count equals to {expected_result_count}' else: - raise Exception(f'ERROR, Expected ngsild_results_count but received: {kwargs}') + raise Exception(f"ERROR, Expected 'expected_result_count' but received: '{kwargs}'") def get_checks(self, **kwargs) -> str: checking = None -- GitLab From 927f5da589da606770a450365cd4095e9c912f24 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Wed, 6 Mar 2024 14:08:11 +0100 Subject: [PATCH 7/8] added back geometry in the doc file --- doc/analysis/requests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index ee11a0a0..66bc76bf 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -1160,6 +1160,8 @@ class Requests: response = f"{response} and\n Query Parameter: georel set to '{value}'" case 'coordinates': response = f"{response} and\n Query Parameter: coordinates set to '{value}'" + case 'geometry': + response = f"{response} and\n Query Parameter: geometry set to '{value}'" case 'count': response = f"{response} and\n Query Parameter: count set to '{value}'" case 'q': -- GitLab From 2489e9a1ecbd8967aae5703f0137602f77e4b5fa Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 17 Mar 2024 18:23:42 +0100 Subject: [PATCH 8/8] fix: add missing JSON documentation --- .../Consumption/019_07.json | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 doc/files/ContextInformation/Consumption/019_07.json diff --git a/doc/files/ContextInformation/Consumption/019_07.json b/doc/files/ContextInformation/Consumption/019_07.json new file mode 100644 index 00000000..72bc4f6a --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_07.json @@ -0,0 +1,55 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_07", + "test_objective": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 6.3.13", + "config_id": "", + "parent_release": "v1.3.1", + "pics_selection": "PICS_6_3_13", + "keywords": [ + "Setup Initial Entities", + "Delete Initial Entities" + ], + "teardown": "Delete Initial Entities", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "019_07_01 Check that the total number of matching results is returned if the count parameter is set to true and only the entity type is provided", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_07_01", + "doc": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "tags": [ + "e-query", + "5_7_2", + "6_3_13" + ], + "setup": null, + "teardown": null, + "template": "Query Entities With Count", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to ${expected_status_code} and\n Query Entities with Response Header: NGSILD-Results-Count equals to 2\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 'Building' and\n Query Parameter: q set to '${q}' and\n Query Parameter: count set to '${True}' 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/" + }, + { + "name": "019_07_02 Check that the total number of matching results is returned if the count parameter is set to true and a q parameter is provided", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_07_02", + "doc": "If the count parameter is set to true the special HTTP header NGSILD-Results-Count is set in the response and it must contain the total number of matching results.", + "tags": [ + "e-query", + "5_7_2", + "6_3_13" + ], + "setup": null, + "teardown": null, + "template": "Query Entities With Count", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to ${expected_status_code} and\n Query Entities with Response Header: NGSILD-Results-Count equals to 1\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 'Building' and\n Query Parameter: q set to '${q}' and\n Query Parameter: count set to '${True}' 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": [ + "then" + ], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_07" +} \ No newline at end of file -- GitLab