Loading tests/features/CAPIF Api Events/capif_events_api.robot +0 −44 Original line number Diff line number Diff line Loading @@ -325,47 +325,3 @@ Prueba JMS Log ${event} List Should Contain Value ${notification_events_on_mock_server} ${event} END *** Keywords *** Create Events From invocationLogs [Arguments] ${subscription_id} ${invocation_log} ${events}= Create List # 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} # Create event details for each log ${event_details}= Create dictionary invocationLogs=${invocation_logs} # Create Event with Event Details from invocationLog and also is appended to events array ${event}= Create Dictionary ... subscriptionId=${subscription_id} ... events=${event_enum} ... eventDetail=${event_details} Check Variable ${event} EventNotification Append To List ${events} ${event} END Log List ${events} ${events_length}= Get Length ${events} RETURN ${events} ${events_length} tests/libraries/mock_server/mock_server.py +2 −2 Original line number Diff line number Diff line from flask import Flask, request import logging from logging.handlers import RotatingFileHandler import os app = Flask(__name__) Loading Loading @@ -53,4 +53,4 @@ def requests_list(): configure_logging(app) if __name__ == '__main__': app.run(host='0.0.0.0',port=9090,debug=True) app.run(host=os.environ.get("IP",'0.0.0.0'),port=os.environ.get("PORT",9090),debug=True) tests/libraries/mock_server/run_mock_server.sh 0 → 100755 +40 −0 Original line number Diff line number Diff line #!/bin/bash help() { echo "Usage: $1 <options>" echo " -i : Setup different host ip for mock server (default 0.0.0.0)" echo " -p : Setup different port for mock server (default 9090)" echo " -h : show this help" exit 1 } IP=0.0.0.0 PORT=9090 # Read params while getopts ":i:p:h" opt; do case $opt in i) IP="$OPTARG" ;; p) PORT=$OPTARG ;; h) help ;; \?) echo "Not valid option: -$OPTARG" >&2 help ;; :) echo "The -$OPTARG option requires an argument." >&2 help ;; esac done echo Robot Framework Mock Server will listen on $IP:$PORT pip install -r requirements.txt IP=$IP PORT=$PORT python mock_server.py tests/resources/common/basicRequests.robot +43 −0 Original line number Diff line number Diff line Loading @@ -744,3 +744,46 @@ Create Security Context Between invoker and provider ... username=${register_user_info_invoker['management_cert']} Check Response Variable Type And Values ${resp} 201 ServiceSecurity Create Events From invocationLogs [Arguments] ${subscription_id} ${invocation_log} ${events}= Create List # 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} # Create event details for each log ${event_details}= Create dictionary invocationLogs=${invocation_logs} # Create Event with Event Details from invocationLog and also is appended to events array ${event}= Create Dictionary ... subscriptionId=${subscription_id} ... events=${event_enum} ... eventDetail=${event_details} Check Variable ${event} EventNotification Append To List ${events} ${event} END Log List ${events} ${events_length}= Get Length ${events} RETURN ${events} ${events_length} Loading
tests/features/CAPIF Api Events/capif_events_api.robot +0 −44 Original line number Diff line number Diff line Loading @@ -325,47 +325,3 @@ Prueba JMS Log ${event} List Should Contain Value ${notification_events_on_mock_server} ${event} END *** Keywords *** Create Events From invocationLogs [Arguments] ${subscription_id} ${invocation_log} ${events}= Create List # 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} # Create event details for each log ${event_details}= Create dictionary invocationLogs=${invocation_logs} # Create Event with Event Details from invocationLog and also is appended to events array ${event}= Create Dictionary ... subscriptionId=${subscription_id} ... events=${event_enum} ... eventDetail=${event_details} Check Variable ${event} EventNotification Append To List ${events} ${event} END Log List ${events} ${events_length}= Get Length ${events} RETURN ${events} ${events_length}
tests/libraries/mock_server/mock_server.py +2 −2 Original line number Diff line number Diff line from flask import Flask, request import logging from logging.handlers import RotatingFileHandler import os app = Flask(__name__) Loading Loading @@ -53,4 +53,4 @@ def requests_list(): configure_logging(app) if __name__ == '__main__': app.run(host='0.0.0.0',port=9090,debug=True) app.run(host=os.environ.get("IP",'0.0.0.0'),port=os.environ.get("PORT",9090),debug=True)
tests/libraries/mock_server/run_mock_server.sh 0 → 100755 +40 −0 Original line number Diff line number Diff line #!/bin/bash help() { echo "Usage: $1 <options>" echo " -i : Setup different host ip for mock server (default 0.0.0.0)" echo " -p : Setup different port for mock server (default 9090)" echo " -h : show this help" exit 1 } IP=0.0.0.0 PORT=9090 # Read params while getopts ":i:p:h" opt; do case $opt in i) IP="$OPTARG" ;; p) PORT=$OPTARG ;; h) help ;; \?) echo "Not valid option: -$OPTARG" >&2 help ;; :) echo "The -$OPTARG option requires an argument." >&2 help ;; esac done echo Robot Framework Mock Server will listen on $IP:$PORT pip install -r requirements.txt IP=$IP PORT=$PORT python mock_server.py
tests/resources/common/basicRequests.robot +43 −0 Original line number Diff line number Diff line Loading @@ -744,3 +744,46 @@ Create Security Context Between invoker and provider ... username=${register_user_info_invoker['management_cert']} Check Response Variable Type And Values ${resp} 201 ServiceSecurity Create Events From invocationLogs [Arguments] ${subscription_id} ${invocation_log} ${events}= Create List # 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} # Create event details for each log ${event_details}= Create dictionary invocationLogs=${invocation_logs} # Create Event with Event Details from invocationLog and also is appended to events array ${event}= Create Dictionary ... subscriptionId=${subscription_id} ... events=${event_enum} ... eventDetail=${event_details} Check Variable ${event} EventNotification Append To List ${events} ${event} END Log List ${events} ${events_length}= Get Length ${events} RETURN ${events} ${events_length}