Commit 57a814b2 authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

Minor improbe con common library

parent 11227f06
Loading
Loading
Loading
Loading
Loading
+106 −106
Original line number Diff line number Diff line
@@ -142,112 +142,112 @@ Deletes an individual CAPIF Event Subscription with invalid SubscriptionId
#     [Tags]  jms-3
#     Start Mock server

Prueba JMS
    [Tags]    jms-1

    # Start Mock server
    Check Mock Server
    Clean Mock Server

    # Register APF
    ${register_user_info}=    Provider Default Registration

    # Publish one api
    Publish Service Api    ${register_user_info}

    # Register INVOKER
    ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding

    ${discover_response}=    Get Request Capif
    ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}

    ${api_ids}    ${api_names}=    Get Api Ids And Names From Discover Response    ${discover_response}

    # Subscribe to events
    ${events_list}=    Create List    SERVICE_API_INVOCATION_SUCCESS    SERVICE_API_INVOCATION_FAILURE
    ${request_body}=    Create Events Subscription
    ...    events=@{events_list}
    ...    notificationDestination=http://192.168.0.14:9090/testing
    ${resp}=    Post Request Capif
    ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
    ...    json=${request_body}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${INVOKER_USERNAME}

    # Check Results
    Check Response Variable Type And Values    ${resp}    201    EventSubscription
    ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}

    ${results}=    Create List    200    400

    # Create Log Entry
    ${request_body}=    Create Log Entry
    ...    ${register_user_info['aef_id']}
    ...    ${register_user_info_invoker['api_invoker_id']}
    ...    ${api_ids}
    ...    ${api_names}
    ...    results=${results}
    ${resp}=    Post Request Capif
    ...    /api-invocation-logs/v1/${register_user_info['aef_id']}/logs
    ...    json=${request_body}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${AEF_PROVIDER_USERNAME}

    # Check Results
    Check Response Variable Type And Values    ${resp}    201    InvocationLog
    ${resource_url}=    Check Location Header    ${resp}    ${LOCATION_LOGGING_RESOURCE_REGEX}

    Sleep    3s

    # Get from Mock server the EventNotification Messages sent to callback setup on event subscription.
    ${resp}=    Get Mock Server Messages
    ${notification_events_on_mock_server}=    Set Variable    ${resp.json()}
    # Check if message follow EventNotification definition.
    Check Variable    ${notification_events_on_mock_server}    EventNotification
    # Check if mock server receive 2 events.
    Length Should Be    ${notification_events_on_mock_server}    2

    # 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    ${request_body}    deepcopy=True

    # Store log array because each log will be notified in one Event Notification
    ${invocation_log_logs}=    Set Variable    ${invocation_log_base['logs']}
    # Remove logs array from invocationLog data
    Remove From Dictionary    ${invocation_log_base}    logs
    Length Should Be    ${invocation_log_logs}    2

    # Create 2 invocationLogs from initial invocationLog present on request
    ${invocation_logs_1}=    Copy Dictionary    ${invocation_log_base}    deepcopy=True
    ${invocation_logs_2}=    Copy Dictionary    ${invocation_log_base}    deepcopy=True
    # Create a log array with only one component
    ${log_1}=    Create List    ${invocation_log_logs[0]}
    ${log_2}=    Create List    ${invocation_log_logs[1]}
    # Setup logs array with previously created list
    Set To Dictionary    ${invocation_logs_1}    logs=${log_1}
    Set To Dictionary    ${invocation_logs_2}    logs=${log_2}
    # Create event details for each log
    ${event_details_1}=    Create dictionary    invocationLogs=${invocation_logs_1}
    ${event_details_2}=    Create dictionary    invocationLogs=${invocation_logs_2}
    # Create Event with Event Details from invocationLog
    ${event_1}=    Create Dictionary
    ...    subscriptionId=${subscription_id}
    ...    events=SERVICE_API_INVOCATION_SUCCESS
    ...    eventDetail=${event_details_1}
    ${event_2}=    Create Dictionary
    ...    subscriptionId=${subscription_id}
    ...    events=SERVICE_API_INVOCATION_FAILURE
    ...    eventDetail=${event_details_2}
    # Check if created events follow EventNotification format defined by 3gpp
    Check Variable    ${event_1}    EventNotification
    Check Variable    ${event_2}    EventNotification

    List Should Contain Value    ${notification_events_on_mock_server}    ${event_1}
    List Should Contain Value    ${notification_events_on_mock_server}    ${event_2}
# Prueba JMS
#     [Tags]    jms-1

#     # Start Mock server
#     Check Mock Server
#     Clean Mock Server

#     # Register APF
#     ${register_user_info}=    Provider Default Registration

#     # Publish one api
#     Publish Service Api    ${register_user_info}

#     # Register INVOKER
#     ${register_user_info_invoker}    ${url}    ${request_body}=    Invoker Default Onboarding

#     ${discover_response}=    Get Request Capif
#     ...    ${DISCOVER_URL}${register_user_info_invoker['api_invoker_id']}
#     ...    server=${CAPIF_HTTPS_URL}
#     ...    verify=ca.crt
#     ...    username=${INVOKER_USERNAME}

#     ${api_ids}    ${api_names}=    Get Api Ids And Names From Discover Response    ${discover_response}

#     # Subscribe to events
#     ${events_list}=    Create List    SERVICE_API_INVOCATION_SUCCESS    SERVICE_API_INVOCATION_FAILURE
#     ${request_body}=    Create Events Subscription
#     ...    events=@{events_list}
#     ...    notificationDestination=http://192.168.0.14:9090/testing
#     ${resp}=    Post Request Capif
#     ...    /capif-events/v1/${register_user_info_invoker['api_invoker_id']}/subscriptions
#     ...    json=${request_body}
#     ...    server=${CAPIF_HTTPS_URL}
#     ...    verify=ca.crt
#     ...    username=${INVOKER_USERNAME}

#     # Check Results
#     Check Response Variable Type And Values    ${resp}    201    EventSubscription
#     ${subscriber_id}    ${subscription_id}=    Check Event Location Header    ${resp}

#     ${results}=    Create List    200    400

#     # Create Log Entry
#     ${request_body}=    Create Log Entry
#     ...    ${register_user_info['aef_id']}
#     ...    ${register_user_info_invoker['api_invoker_id']}
#     ...    ${api_ids}
#     ...    ${api_names}
#     ...    results=${results}
#     ${resp}=    Post Request Capif
#     ...    /api-invocation-logs/v1/${register_user_info['aef_id']}/logs
#     ...    json=${request_body}
#     ...    server=${CAPIF_HTTPS_URL}
#     ...    verify=ca.crt
#     ...    username=${AEF_PROVIDER_USERNAME}

#     # Check Results
#     Check Response Variable Type And Values    ${resp}    201    InvocationLog
#     ${resource_url}=    Check Location Header    ${resp}    ${LOCATION_LOGGING_RESOURCE_REGEX}

#     Sleep    3s

#     # Get from Mock server the EventNotification Messages sent to callback setup on event subscription.
#     ${resp}=    Get Mock Server Messages
#     ${notification_events_on_mock_server}=    Set Variable    ${resp.json()}
#     # Check if message follow EventNotification definition.
#     Check Variable    ${notification_events_on_mock_server}    EventNotification
#     # Check if mock server receive 2 events.
#     Length Should Be    ${notification_events_on_mock_server}    2

#     # 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    ${request_body}    deepcopy=True

#     # Store log array because each log will be notified in one Event Notification
#     ${invocation_log_logs}=    Set Variable    ${invocation_log_base['logs']}
#     # Remove logs array from invocationLog data
#     Remove From Dictionary    ${invocation_log_base}    logs
#     Length Should Be    ${invocation_log_logs}    2

#     # Create 2 invocationLogs from initial invocationLog present on request
#     ${invocation_logs_1}=    Copy Dictionary    ${invocation_log_base}    deepcopy=True
#     ${invocation_logs_2}=    Copy Dictionary    ${invocation_log_base}    deepcopy=True
#     # Create a log array with only one component
#     ${log_1}=    Create List    ${invocation_log_logs[0]}
#     ${log_2}=    Create List    ${invocation_log_logs[1]}
#     # Setup logs array with previously created list
#     Set To Dictionary    ${invocation_logs_1}    logs=${log_1}
#     Set To Dictionary    ${invocation_logs_2}    logs=${log_2}
#     # Create event details for each log
#     ${event_details_1}=    Create dictionary    invocationLogs=${invocation_logs_1}
#     ${event_details_2}=    Create dictionary    invocationLogs=${invocation_logs_2}
#     # Create Event with Event Details from invocationLog
#     ${event_1}=    Create Dictionary
#     ...    subscriptionId=${subscription_id}
#     ...    events=SERVICE_API_INVOCATION_SUCCESS
#     ...    eventDetail=${event_details_1}
#     ${event_2}=    Create Dictionary
#     ...    subscriptionId=${subscription_id}
#     ...    events=SERVICE_API_INVOCATION_FAILURE
#     ...    eventDetail=${event_details_2}
#     # Check if created events follow EventNotification format defined by 3gpp
#     Check Variable    ${event_1}    EventNotification
#     Check Variable    ${event_2}    EventNotification

#     List Should Contain Value    ${notification_events_on_mock_server}    ${event_1}
#     List Should Contain Value    ${notification_events_on_mock_server}    ${event_2}

Prueba JMS
    [Tags]    jms-2
+1 −0
Original line number Diff line number Diff line
@@ -457,6 +457,7 @@ Get Auth For User
    ${resp}=    GET On Session    register_session    /getauth    auth=${auth}

    Should Be Equal As Strings    ${resp.status_code}    200
    Log Dictionary    ${resp.json()}

    RETURN    ${resp.json()}