Loading TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot +14 −1 Original line number Diff line number Diff line Loading @@ -26,9 +26,22 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample ... subscription_id=${subscription_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List ${status_regex_expr} # We need to ignore the Additional Members ('lastFailure', 'lastNotification', 'timesFailed', 'timesSent') ${ignored_attributes}= Create List ... ${status_regex_expr} ... ${lastfailure_regex_expr} ... ${lastNotification_regex_expr} ... ${timesFailed_regex_expr} ... ${timesSent_regex_expr} Check Created Resource Set To ${subscription_payload} ${response1.json()} ${ignored_attributes} Check Dictionary Might Contain Additional Members ${response1.json()} lastNotification Check Dictionary Might Contain Additional Members ${response1.json()} lastFailure Check Dictionary Might Contain Additional Members ${response1.json()} lastSuccess Check Dictionary Might Contain Additional Members ${response1.json()} timesSent *** Keywords *** Generate Random Ids For Context Source Registration Subscriptions Loading TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot +13 −5 Original line number Diff line number Diff line Loading @@ -4,13 +4,13 @@ Documentation Check that you can create a context source registration subs Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Suite Teardown Delete Created Context Source Registration Subscriptions *** Variables *** ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld ${subscription_id}= ${EMPTY} *** Test Cases *** Loading @@ -18,11 +18,15 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample [Documentation] Check that you can create a context source registration subscription without providing an id and it will be automatically generated [Tags] csrsub-create 5_11_2 ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} Remove From Dictionary ${subscription_payload} id ${response}= Create Context Source Registration Subscription ${subscription_payload} ${subscription_id}= Fetch Id From Response Location Header ${response.headers} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${subscription_id} ${response.headers} Dictionary Should Contain Key ${response.headers} Location msg=HTTP Headers do not contain key 'Location' ${subscription_id}= Get From Dictionary ${response.headers} Location Set Suite Variable ${subscription_id} Check Response Status Code 201 ${response.status_code} ${response1}= Retrieve Context Source Registration Subscription ... subscription_id=${subscription_id} ... context=${ngsild_test_suite_context} Loading @@ -33,4 +37,8 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample *** Keywords *** Delete Created Context Source Registration Subscriptions IF "${subscription_id}" != "${EMPTY}" Delete Context Source Registration Subscription ${subscription_id} ELSE Log To Console \nThere was no Context Source Registration Subscription to delete\n END TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-expire [Tags] csrsub-create 5_11_2 ${subscription_payload_sample}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} ${current_date}= Get Current Date time_zone=UTC result_format=${date_format} ${expiresAt}= Add Time To Date ${current_date} 10 seconds date_format=${date_format} ${expiresAt}= Add Time To Date ${current_date} 10 seconds result_format=${date_format} ${subscription_payload}= Update Value To JSON ${subscription_payload_sample} $..expiresAt ${expiresAt} ${response}= Create Context Source Registration Subscription ${subscription_payload} Check Response Status Code 201 ${response.status_code} Loading doc/analysis/generaterobotdata.py +0 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ class GenerateRobotData: self.config_variables = ParseVariablesFile() self.robot = ParseRobotFile(filename=robot_file, execdir=execdir, config_file=self.config_variables) # TODO: the robot file can provide several ApiUtils not only one self.apiutils = [ParseApiUtilsFile(filename=file) for file in self.robot.resource_files] self.robot.set_apiutils(self.apiutils) Loading resources/AssertionUtils.resource +34 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ ${notification_timestamps_regex_expr}= root\\['last.*'\\] ${notification_endpoint_uri_regex_expr}= root\\['endpoint'\\]\\['uri'\\] ${context_regex_expr}= root\\['@context'\\] ${status_regex_expr}= root\\['status'\\] ${lastfailure_regex_expr}= root\\['lastFailure'\\] ${lastNotification_regex_expr}= root\\['lastNotification'\\] ${timesFailed_regex_expr}= root\\['timesFailed'\\] ${timesSent_regex_expr}= root\\['timesSent'\\] *** Keywords *** Loading Loading @@ -444,3 +448,33 @@ Check Retrieving Context Source Registration ... accept=${accept} ${ignored_attributes}= Create List ${status_regex_expr} @context Check Updated Resource Set To ${registration_payload} ${response.json()} ${ignored_attributes} Check Dictionary Might Contain Additional Members # Check the Additional Members 5.2.14.2 in the NotificationParams data structure [Arguments] ${dictionary} ${key} Log Dictionary Might Contain Key with a specific type Log Dictionary: ${dictionary} Log Key: ${key} ${value}= Evaluate $dictionary.get($key) IF '${value}' != '' and '${value}' != 'None' IF "${key}" == "lastNotification" or "${key}" == "lastFailure" or "${key}" == "lastSuccess" # Need to check that there is a DateTime value ${date}= Parse Ngsild Date ${dictionary}[${key}] Should Not Be Equal ... ${date} ... ${None} ... The Additional Member ${key} contains a value (${value}) that it is not in DateTime format END IF "${key}" == "timesSent" # Need to check that there is a Integer value ${type int}= Evaluate type(${dictionary}[${key}]).__name__ Should Be Equal ... ${type int} ... int ... The Additonal Member ${key} contains a value (${value}) that it is not in Number format END ELSE Log The key '${key}' is not present in the dictionary END Loading
TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_01.robot +14 −1 Original line number Diff line number Diff line Loading @@ -26,9 +26,22 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample ... subscription_id=${subscription_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List ${status_regex_expr} # We need to ignore the Additional Members ('lastFailure', 'lastNotification', 'timesFailed', 'timesSent') ${ignored_attributes}= Create List ... ${status_regex_expr} ... ${lastfailure_regex_expr} ... ${lastNotification_regex_expr} ... ${timesFailed_regex_expr} ... ${timesSent_regex_expr} Check Created Resource Set To ${subscription_payload} ${response1.json()} ${ignored_attributes} Check Dictionary Might Contain Additional Members ${response1.json()} lastNotification Check Dictionary Might Contain Additional Members ${response1.json()} lastFailure Check Dictionary Might Contain Additional Members ${response1.json()} lastSuccess Check Dictionary Might Contain Additional Members ${response1.json()} timesSent *** Keywords *** Generate Random Ids For Context Source Registration Subscriptions Loading
TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_02.robot +13 −5 Original line number Diff line number Diff line Loading @@ -4,13 +4,13 @@ Documentation Check that you can create a context source registration subs Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistrationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/HttpUtils.resource Suite Teardown Delete Created Context Source Registration Subscriptions *** Variables *** ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample.jsonld ${subscription_id}= ${EMPTY} *** Test Cases *** Loading @@ -18,11 +18,15 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample [Documentation] Check that you can create a context source registration subscription without providing an id and it will be automatically generated [Tags] csrsub-create 5_11_2 ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} Remove From Dictionary ${subscription_payload} id ${response}= Create Context Source Registration Subscription ${subscription_payload} ${subscription_id}= Fetch Id From Response Location Header ${response.headers} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${subscription_id} ${response.headers} Dictionary Should Contain Key ${response.headers} Location msg=HTTP Headers do not contain key 'Location' ${subscription_id}= Get From Dictionary ${response.headers} Location Set Suite Variable ${subscription_id} Check Response Status Code 201 ${response.status_code} ${response1}= Retrieve Context Source Registration Subscription ... subscription_id=${subscription_id} ... context=${ngsild_test_suite_context} Loading @@ -33,4 +37,8 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-sample *** Keywords *** Delete Created Context Source Registration Subscriptions IF "${subscription_id}" != "${EMPTY}" Delete Context Source Registration Subscription ${subscription_id} ELSE Log To Console \nThere was no Context Source Registration Subscription to delete\n END
TP/NGSI-LD/ContextSource/RegistrationSubscription/CreateContextSourceRegistrationSubscription/038_05.robot +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ ${subscription_payload_file_path}= csourceSubscriptions/subscription-expire [Tags] csrsub-create 5_11_2 ${subscription_payload_sample}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} ${current_date}= Get Current Date time_zone=UTC result_format=${date_format} ${expiresAt}= Add Time To Date ${current_date} 10 seconds date_format=${date_format} ${expiresAt}= Add Time To Date ${current_date} 10 seconds result_format=${date_format} ${subscription_payload}= Update Value To JSON ${subscription_payload_sample} $..expiresAt ${expiresAt} ${response}= Create Context Source Registration Subscription ${subscription_payload} Check Response Status Code 201 ${response.status_code} Loading
doc/analysis/generaterobotdata.py +0 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ class GenerateRobotData: self.config_variables = ParseVariablesFile() self.robot = ParseRobotFile(filename=robot_file, execdir=execdir, config_file=self.config_variables) # TODO: the robot file can provide several ApiUtils not only one self.apiutils = [ParseApiUtilsFile(filename=file) for file in self.robot.resource_files] self.robot.set_apiutils(self.apiutils) Loading
resources/AssertionUtils.resource +34 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,10 @@ ${notification_timestamps_regex_expr}= root\\['last.*'\\] ${notification_endpoint_uri_regex_expr}= root\\['endpoint'\\]\\['uri'\\] ${context_regex_expr}= root\\['@context'\\] ${status_regex_expr}= root\\['status'\\] ${lastfailure_regex_expr}= root\\['lastFailure'\\] ${lastNotification_regex_expr}= root\\['lastNotification'\\] ${timesFailed_regex_expr}= root\\['timesFailed'\\] ${timesSent_regex_expr}= root\\['timesSent'\\] *** Keywords *** Loading Loading @@ -444,3 +448,33 @@ Check Retrieving Context Source Registration ... accept=${accept} ${ignored_attributes}= Create List ${status_regex_expr} @context Check Updated Resource Set To ${registration_payload} ${response.json()} ${ignored_attributes} Check Dictionary Might Contain Additional Members # Check the Additional Members 5.2.14.2 in the NotificationParams data structure [Arguments] ${dictionary} ${key} Log Dictionary Might Contain Key with a specific type Log Dictionary: ${dictionary} Log Key: ${key} ${value}= Evaluate $dictionary.get($key) IF '${value}' != '' and '${value}' != 'None' IF "${key}" == "lastNotification" or "${key}" == "lastFailure" or "${key}" == "lastSuccess" # Need to check that there is a DateTime value ${date}= Parse Ngsild Date ${dictionary}[${key}] Should Not Be Equal ... ${date} ... ${None} ... The Additional Member ${key} contains a value (${value}) that it is not in DateTime format END IF "${key}" == "timesSent" # Need to check that there is a Integer value ${type int}= Evaluate type(${dictionary}[${key}]).__name__ Should Be Equal ... ${type int} ... int ... The Additonal Member ${key} contains a value (${value}) that it is not in Number format END ELSE Log The key '${key}' is not present in the dictionary END