Loading tests/features/Api Status/api_status.robot +2 −208 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ ${SUBSCRIPTION_ID_NOT_VALID} not-valid *** Test Cases *** *** Test Cases *** Invoker receives Service API Invocation events Invoker receives Service API Invocation events [Tags] api_status-X mockserver smoke [Tags] api_status-x mockserver smoke # Initialize Mock server # Initialize Mock server Init Mock Server Init Mock Server Loading Loading @@ -78,209 +78,3 @@ Invoker receives Service API Invocation events ... service_api_unavailable_resources=${service_api_unavailable_resources} ... service_api_unavailable_resources=${service_api_unavailable_resources} ## Check Events Expected towards received notifications at mock server ## Check Events Expected towards received notifications at mock server Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} *** Keywords *** Create Events From InvocationLogs [Arguments] ... ${subscription_id} ... ${invocation_log} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END # Now we create the expected events received at notification server according to logs sent to loggin service in order to check if all are present. ${invocation_log_base}= Copy Dictionary ${invocation_log} deepcopy=True # Store log array because each log will be notified in one Event Notification ${invocation_log_logs}= Copy List ${invocation_log_base['logs']} # Remove logs array from invocationLog data Remove From Dictionary ${invocation_log_base} logs FOR ${log} IN @{invocation_log_logs} Log Dictionary ${log} ${invocation_logs}= Copy Dictionary ${invocation_log_base} deepcopy=True # Get Event Enum for this result ${event_enum}= Set Variable IF ${log['result']} >= 200 and ${log['result']} < 300 ${event_enum}= Set Variable SERVICE_API_INVOCATION_SUCCESS ELSE ${event_enum}= Set Variable SERVICE_API_INVOCATION_FAILURE END # Create a log array with only one component ${log_list}= Create List ${log} # Setup logs array with previously created list Set To Dictionary ${invocation_logs} logs=${log_list} IF "${event_detail_expected}" != "${TRUE}" ${invocation_logs}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ${event_enum} ... invocationLogs=${invocation_logs} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Events For Service API Notifications [Arguments] ... ${subscription_id} ... ${service_api_available_resources}=${NONE} ... ${service_api_unavailable_resources}=${NONE} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END IF "${service_api_available_resources}" != "${NONE}" FOR ${service_api_available_resource} IN @{service_api_available_resources} Log ${service_api_available_resource} ${api_id}= Fetch From Right ${service_api_available_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_AVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END END IF "${service_api_unavailable_resources}" != "${NONE}" FOR ${service_api_unavailable_resource} IN @{service_api_unavailable_resources} Log ${service_api_unavailable_resource} ${api_id}= Fetch From Right ${service_api_unavailable_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UNAVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END END RETURN ${events_expected} Create Expected Api Invoker Events [Arguments] ... ${subscription_id} ... ${api_invoker_id} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_invoker_id_used}= Set Variable ${api_invoker_id} IF "${event_detail_expected}" != "${TRUE}" ${api_invoker_id_used}= Set Variable ${NONE} END ## Create events expected # Create Notification Events expected to be received for Onboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_ONBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Updated event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_UPDATED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Offboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_OFFBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Update Event [Arguments] ... ${subscription_id} ... ${service_api_id} ... ${api_invoker_policies} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${acc_ctrl_pol_list}= Create Dictionary apiId=${service_api_id} apiInvokerPolicies=${api_invoker_policies} Check Variable ${acc_ctrl_pol_list} AccessControlPolicyListExt IF "${event_detail_expected}" != "${TRUE}" ${acc_ctrl_pol_list}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UPDATE ... accCtrlPolList=${acc_ctrl_pol_list} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Unavailable [Arguments] ${subscription_id} ... ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UNAVAILABLE Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Api Invoker Authorization Revoked [Arguments] ${subscription_id} ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_AUTHORIZATION_REVOKED Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Service Update Event [Arguments] ... ${subscription_id} ... ${service_api_resource} ... ${service_api_descriptions} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_id}= Fetch From Right ${service_api_resource.path} / Set To Dictionary ${service_api_descriptions} apiId=${api_id} IF "${event_detail_expected}" != "${TRUE}" ${service_api_descriptions}= Set Variable ${NONE} END ${events_expected}= Create List ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UPDATE ... serviceAPIDescriptions=${service_api_descriptions} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} tests/features/CAPIF Api Events/capif_events_api.robot +0 −202 Original line number Original line Diff line number Diff line Loading @@ -1210,205 +1210,3 @@ Invoker receives an Invoker Authorization Revoked and ACL unavailable event when ... events_expected=${events_expected} ... events_expected=${events_expected} ## Check Events Expected towards received notifications at mock server ## Check Events Expected towards received notifications at mock server Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} *** Keywords *** Create Events From InvocationLogs [Arguments] ... ${subscription_id} ... ${invocation_log} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END # Now we create the expected events received at notification server according to logs sent to loggin service in order to check if all are present. ${invocation_log_base}= Copy Dictionary ${invocation_log} deepcopy=True # Store log array because each log will be notified in one Event Notification ${invocation_log_logs}= Copy List ${invocation_log_base['logs']} # Remove logs array from invocationLog data Remove From Dictionary ${invocation_log_base} logs FOR ${log} IN @{invocation_log_logs} Log Dictionary ${log} ${invocation_logs}= Copy Dictionary ${invocation_log_base} deepcopy=True # Get Event Enum for this result ${event_enum}= Set Variable IF ${log['result']} >= 200 and ${log['result']} < 300 ${event_enum}= Set Variable SERVICE_API_INVOCATION_SUCCESS ELSE ${event_enum}= Set Variable SERVICE_API_INVOCATION_FAILURE END # Create a log array with only one component ${log_list}= Create List ${log} # Setup logs array with previously created list Set To Dictionary ${invocation_logs} logs=${log_list} IF "${event_detail_expected}" != "${TRUE}" ${invocation_logs}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ${event_enum} ... invocationLogs=${invocation_logs} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Events For Service API Notifications [Arguments] ... ${subscription_id} ... ${service_api_available_resources}=${NONE} ... ${service_api_unavailable_resources}=${NONE} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END FOR ${service_api_available_resource} IN @{service_api_available_resources} Log ${service_api_available_resource} ${api_id}= Fetch From Right ${service_api_available_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_AVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END FOR ${service_api_unavailable_resource} IN @{service_api_unavailable_resources} Log ${service_api_unavailable_resource} ${api_id}= Fetch From Right ${service_api_unavailable_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UNAVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Api Invoker Events [Arguments] ... ${subscription_id} ... ${api_invoker_id} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_invoker_id_used}= Set Variable ${api_invoker_id} IF "${event_detail_expected}" != "${TRUE}" ${api_invoker_id_used}= Set Variable ${NONE} END ## Create events expected # Create Notification Events expected to be received for Onboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_ONBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Updated event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_UPDATED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Offboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_OFFBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Update Event [Arguments] ... ${subscription_id} ... ${service_api_id} ... ${api_invoker_policies} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${acc_ctrl_pol_list}= Create Dictionary apiId=${service_api_id} apiInvokerPolicies=${api_invoker_policies} Check Variable ${acc_ctrl_pol_list} AccessControlPolicyListExt IF "${event_detail_expected}" != "${TRUE}" ${acc_ctrl_pol_list}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UPDATE ... accCtrlPolList=${acc_ctrl_pol_list} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Unavailable [Arguments] ${subscription_id} ... ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UNAVAILABLE Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Api Invoker Authorization Revoked [Arguments] ${subscription_id} ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_AUTHORIZATION_REVOKED Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Service Update Event [Arguments] ... ${subscription_id} ... ${service_api_resource} ... ${service_api_descriptions} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_id}= Fetch From Right ${service_api_resource.path} / Set To Dictionary ${service_api_descriptions} apiId=${api_id} IF "${event_detail_expected}" != "${TRUE}" ${service_api_descriptions}= Set Variable ${NONE} END ${events_expected}= Create List ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UPDATE ... serviceAPIDescriptions=${service_api_descriptions} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} tests/libraries/common/bodyRequests.py +1 −20 Original line number Original line Diff line number Diff line Loading @@ -116,15 +116,6 @@ def check_attributes_dict(body, data_type): return all_attributes return all_attributes def sign_csr_body(username, public_key): data = { "csr": public_key.decode("utf-8"), "mode": "client", "filename": username } return data def check_uri(input, rule): def check_uri(input, rule): if rfc3987.match(input, rule=rule) is not None: if rfc3987.match(input, rule=rule) is not None: return input return input Loading @@ -140,13 +131,3 @@ def check_regex(input, regex): return True return True else: else: raise Exception("Input(" + input + ") not match regex (" + regex + ")") raise Exception("Input(" + input + ") not match regex (" + regex + ")") def vault_sign_superadmin_certificate_body(csr_request): data = { 'format': 'pem_bundle', 'ttl': '43000h', 'csr': csr_request, 'common_name': "superadmin" } return data tests/libraries/helpers.py +0 −19 Original line number Original line Diff line number Diff line Loading @@ -162,22 +162,3 @@ def filter_users_by_prefix_username(users, prefix): if user['username'].startswith(prefix): if user['username'].startswith(prefix): filtered_users.append(user['username']) filtered_users.append(user['username']) return filtered_users return filtered_users def sign_csr_body(username, public_key): data = { "csr": public_key.decode("utf-8"), "mode": "client", "filename": username } return data def vault_sign_superadmin_certificate_body(csr_request): data = { "format": "pem_bundle", "ttl": "43000h", "csr": csr_request.decode("utf-8"), "common_name": "superadmin" } return data tests/resources/common.resource +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ Library Process Library Collections Library Collections Variables /opt/robot-tests/tests/libraries/environment.py Variables /opt/robot-tests/tests/libraries/environment.py Resource /opt/robot-tests/tests/resources/common/basicRequests.robot Resource /opt/robot-tests/tests/resources/common/basicRequests.robot Resource /opt/robot-tests/tests/resources/common/expectedMessages.robot *** Variables *** *** Variables *** Loading Loading
tests/features/Api Status/api_status.robot +2 −208 Original line number Original line Diff line number Diff line Loading @@ -19,7 +19,7 @@ ${SUBSCRIPTION_ID_NOT_VALID} not-valid *** Test Cases *** *** Test Cases *** Invoker receives Service API Invocation events Invoker receives Service API Invocation events [Tags] api_status-X mockserver smoke [Tags] api_status-x mockserver smoke # Initialize Mock server # Initialize Mock server Init Mock Server Init Mock Server Loading Loading @@ -78,209 +78,3 @@ Invoker receives Service API Invocation events ... service_api_unavailable_resources=${service_api_unavailable_resources} ... service_api_unavailable_resources=${service_api_unavailable_resources} ## Check Events Expected towards received notifications at mock server ## Check Events Expected towards received notifications at mock server Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} *** Keywords *** Create Events From InvocationLogs [Arguments] ... ${subscription_id} ... ${invocation_log} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END # Now we create the expected events received at notification server according to logs sent to loggin service in order to check if all are present. ${invocation_log_base}= Copy Dictionary ${invocation_log} deepcopy=True # Store log array because each log will be notified in one Event Notification ${invocation_log_logs}= Copy List ${invocation_log_base['logs']} # Remove logs array from invocationLog data Remove From Dictionary ${invocation_log_base} logs FOR ${log} IN @{invocation_log_logs} Log Dictionary ${log} ${invocation_logs}= Copy Dictionary ${invocation_log_base} deepcopy=True # Get Event Enum for this result ${event_enum}= Set Variable IF ${log['result']} >= 200 and ${log['result']} < 300 ${event_enum}= Set Variable SERVICE_API_INVOCATION_SUCCESS ELSE ${event_enum}= Set Variable SERVICE_API_INVOCATION_FAILURE END # Create a log array with only one component ${log_list}= Create List ${log} # Setup logs array with previously created list Set To Dictionary ${invocation_logs} logs=${log_list} IF "${event_detail_expected}" != "${TRUE}" ${invocation_logs}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ${event_enum} ... invocationLogs=${invocation_logs} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Events For Service API Notifications [Arguments] ... ${subscription_id} ... ${service_api_available_resources}=${NONE} ... ${service_api_unavailable_resources}=${NONE} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END IF "${service_api_available_resources}" != "${NONE}" FOR ${service_api_available_resource} IN @{service_api_available_resources} Log ${service_api_available_resource} ${api_id}= Fetch From Right ${service_api_available_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_AVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END END IF "${service_api_unavailable_resources}" != "${NONE}" FOR ${service_api_unavailable_resource} IN @{service_api_unavailable_resources} Log ${service_api_unavailable_resource} ${api_id}= Fetch From Right ${service_api_unavailable_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UNAVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END END RETURN ${events_expected} Create Expected Api Invoker Events [Arguments] ... ${subscription_id} ... ${api_invoker_id} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_invoker_id_used}= Set Variable ${api_invoker_id} IF "${event_detail_expected}" != "${TRUE}" ${api_invoker_id_used}= Set Variable ${NONE} END ## Create events expected # Create Notification Events expected to be received for Onboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_ONBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Updated event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_UPDATED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Offboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_OFFBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Update Event [Arguments] ... ${subscription_id} ... ${service_api_id} ... ${api_invoker_policies} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${acc_ctrl_pol_list}= Create Dictionary apiId=${service_api_id} apiInvokerPolicies=${api_invoker_policies} Check Variable ${acc_ctrl_pol_list} AccessControlPolicyListExt IF "${event_detail_expected}" != "${TRUE}" ${acc_ctrl_pol_list}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UPDATE ... accCtrlPolList=${acc_ctrl_pol_list} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Unavailable [Arguments] ${subscription_id} ... ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UNAVAILABLE Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Api Invoker Authorization Revoked [Arguments] ${subscription_id} ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_AUTHORIZATION_REVOKED Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Service Update Event [Arguments] ... ${subscription_id} ... ${service_api_resource} ... ${service_api_descriptions} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_id}= Fetch From Right ${service_api_resource.path} / Set To Dictionary ${service_api_descriptions} apiId=${api_id} IF "${event_detail_expected}" != "${TRUE}" ${service_api_descriptions}= Set Variable ${NONE} END ${events_expected}= Create List ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UPDATE ... serviceAPIDescriptions=${service_api_descriptions} Append To List ${events_expected} ${event_expected} RETURN ${events_expected}
tests/features/CAPIF Api Events/capif_events_api.robot +0 −202 Original line number Original line Diff line number Diff line Loading @@ -1210,205 +1210,3 @@ Invoker receives an Invoker Authorization Revoked and ACL unavailable event when ... events_expected=${events_expected} ... events_expected=${events_expected} ## Check Events Expected towards received notifications at mock server ## Check Events Expected towards received notifications at mock server Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} Wait Until Keyword Succeeds 5x 5s Check Mock Server Notification Events ${events_expected} *** Keywords *** Create Events From InvocationLogs [Arguments] ... ${subscription_id} ... ${invocation_log} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END # Now we create the expected events received at notification server according to logs sent to loggin service in order to check if all are present. ${invocation_log_base}= Copy Dictionary ${invocation_log} deepcopy=True # Store log array because each log will be notified in one Event Notification ${invocation_log_logs}= Copy List ${invocation_log_base['logs']} # Remove logs array from invocationLog data Remove From Dictionary ${invocation_log_base} logs FOR ${log} IN @{invocation_log_logs} Log Dictionary ${log} ${invocation_logs}= Copy Dictionary ${invocation_log_base} deepcopy=True # Get Event Enum for this result ${event_enum}= Set Variable IF ${log['result']} >= 200 and ${log['result']} < 300 ${event_enum}= Set Variable SERVICE_API_INVOCATION_SUCCESS ELSE ${event_enum}= Set Variable SERVICE_API_INVOCATION_FAILURE END # Create a log array with only one component ${log_list}= Create List ${log} # Setup logs array with previously created list Set To Dictionary ${invocation_logs} logs=${log_list} IF "${event_detail_expected}" != "${TRUE}" ${invocation_logs}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ${event_enum} ... invocationLogs=${invocation_logs} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Events For Service API Notifications [Arguments] ... ${subscription_id} ... ${service_api_available_resources}=${NONE} ... ${service_api_unavailable_resources}=${NONE} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END FOR ${service_api_available_resource} IN @{service_api_available_resources} Log ${service_api_available_resource} ${api_id}= Fetch From Right ${service_api_available_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_AVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END FOR ${service_api_unavailable_resource} IN @{service_api_unavailable_resources} Log ${service_api_unavailable_resource} ${api_id}= Fetch From Right ${service_api_unavailable_resource.path} / IF "${event_detail_expected}" != "${TRUE}" ${api_id}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UNAVAILABLE ... apiIds=${api_id} Append To List ${events_expected} ${event_expected} END RETURN ${events_expected} Create Expected Api Invoker Events [Arguments] ... ${subscription_id} ... ${api_invoker_id} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_invoker_id_used}= Set Variable ${api_invoker_id} IF "${event_detail_expected}" != "${TRUE}" ${api_invoker_id_used}= Set Variable ${NONE} END ## Create events expected # Create Notification Events expected to be received for Onboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_ONBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Updated event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_UPDATED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} # Create Notification Events expected to be received for Offboard event ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_OFFBOARDED ... apiInvokerIds=${api_invoker_id_used} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Update Event [Arguments] ... ${subscription_id} ... ${service_api_id} ... ${api_invoker_policies} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${acc_ctrl_pol_list}= Create Dictionary apiId=${service_api_id} apiInvokerPolicies=${api_invoker_policies} Check Variable ${acc_ctrl_pol_list} AccessControlPolicyListExt IF "${event_detail_expected}" != "${TRUE}" ${acc_ctrl_pol_list}= Set Variable ${NONE} END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UPDATE ... accCtrlPolList=${acc_ctrl_pol_list} Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Access Control Policy Unavailable [Arguments] ${subscription_id} ... ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... ACCESS_CONTROL_POLICY_UNAVAILABLE Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Api Invoker Authorization Revoked [Arguments] ${subscription_id} ${events_expected}=${NONE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${event_expected}= Create Notification Event ... ${subscription_id} ... API_INVOKER_AUTHORIZATION_REVOKED Append To List ${events_expected} ${event_expected} RETURN ${events_expected} Create Expected Service Update Event [Arguments] ... ${subscription_id} ... ${service_api_resource} ... ${service_api_descriptions} ... ${events_expected}=${NONE} ... ${event_detail_expected}=${TRUE} IF ${events_expected} == ${NONE} ${events_expected}= Create List END ${api_id}= Fetch From Right ${service_api_resource.path} / Set To Dictionary ${service_api_descriptions} apiId=${api_id} IF "${event_detail_expected}" != "${TRUE}" ${service_api_descriptions}= Set Variable ${NONE} END ${events_expected}= Create List ${event_expected}= Create Notification Event ... ${subscription_id} ... SERVICE_API_UPDATE ... serviceAPIDescriptions=${service_api_descriptions} Append To List ${events_expected} ${event_expected} RETURN ${events_expected}
tests/libraries/common/bodyRequests.py +1 −20 Original line number Original line Diff line number Diff line Loading @@ -116,15 +116,6 @@ def check_attributes_dict(body, data_type): return all_attributes return all_attributes def sign_csr_body(username, public_key): data = { "csr": public_key.decode("utf-8"), "mode": "client", "filename": username } return data def check_uri(input, rule): def check_uri(input, rule): if rfc3987.match(input, rule=rule) is not None: if rfc3987.match(input, rule=rule) is not None: return input return input Loading @@ -140,13 +131,3 @@ def check_regex(input, regex): return True return True else: else: raise Exception("Input(" + input + ") not match regex (" + regex + ")") raise Exception("Input(" + input + ") not match regex (" + regex + ")") def vault_sign_superadmin_certificate_body(csr_request): data = { 'format': 'pem_bundle', 'ttl': '43000h', 'csr': csr_request, 'common_name': "superadmin" } return data
tests/libraries/helpers.py +0 −19 Original line number Original line Diff line number Diff line Loading @@ -162,22 +162,3 @@ def filter_users_by_prefix_username(users, prefix): if user['username'].startswith(prefix): if user['username'].startswith(prefix): filtered_users.append(user['username']) filtered_users.append(user['username']) return filtered_users return filtered_users def sign_csr_body(username, public_key): data = { "csr": public_key.decode("utf-8"), "mode": "client", "filename": username } return data def vault_sign_superadmin_certificate_body(csr_request): data = { "format": "pem_bundle", "ttl": "43000h", "csr": csr_request.decode("utf-8"), "common_name": "superadmin" } return data
tests/resources/common.resource +1 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,7 @@ Library Process Library Collections Library Collections Variables /opt/robot-tests/tests/libraries/environment.py Variables /opt/robot-tests/tests/libraries/environment.py Resource /opt/robot-tests/tests/resources/common/basicRequests.robot Resource /opt/robot-tests/tests/resources/common/basicRequests.robot Resource /opt/robot-tests/tests/resources/common/expectedMessages.robot *** Variables *** *** Variables *** Loading