Draft: [DELAYED]Resolve "Add new test to check audit multiple logs"

Proposers

  • Jorge Moratinos (TID)

Description

We need to include a new test on audit test suite to check multiple logs created by AEF.

Acknowledgements

This work is funded by the European Commission through the HORIZON-JU-SNS-2022 call of FIDAL project with Grant Agreement number 101096146.

Closes #147

Merge request reports

Loading
+82 −0
Changes for tests/features/CAPIF Api Auditing Service/capif_auditing_api.robot: 82 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -216,3 +216,85 @@ Get Log Entry with no exist apiVersion filter
    ...    status=404
    ...    detail=Parameters do not match any log entry
    ...    cause=No logs found

Get CAPIF Multiple Log Entries
    [Tags]    capif_api_auditing_service-6
    # Register APF
    ${register_user_info}=    Provider Default Registration

    # Publish one api
    Publish Service Api    ${register_user_info}

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

    # Register INVOKER
    ${register_user_info_invoker_2}    ${url}    ${request_body}=    Invoker Default Onboarding    invoker_username=${INVOKER_USERNAME}_2

    ${discover_response}=    Get Request Capif
    ...    ${DISCOVER_URL}${register_user_info_invoker_1['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}

    # Create Log Entry
    ${request_body}=    Create Log Entry
    ...    ${register_user_info['aef_id']}
    ...    ${register_user_info_invoker_1['api_invoker_id']}
    ...    ${api_ids}
    ...    ${api_names}
    ${resp_1}=    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}

    # Create Log Entry
    ${results}=   Create List   200
    ${request_body}=    Create Log Entry
    ...    ${register_user_info['aef_id']}
    ...    ${register_user_info_invoker_1['api_invoker_id']}
    ...    ${api_ids}
    ...    ${api_names}
    ...    results=${results}
    ${resp_1}=    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}

    # Create Log Entry
    ${request_body}=    Create Log Entry
    ...    ${register_user_info['aef_id']}
    ...    ${register_user_info_invoker_2['api_invoker_id']}
    ...    ${api_ids}
    ...    ${api_names}
    ${resp_1}=    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}

    ${resp_2}=    Get Request Capif
    ...    /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker_1['api_invoker_id']}
    ...    server=${CAPIF_HTTPS_URL}
    ...    verify=ca.crt
    ...    username=${AMF_PROVIDER_USERNAME}

    # Check Results
    Check Response Variable Type And Values    ${resp_2}    200    InvocationLog
    Length Should Be    ${resp_2.json()["logs"]}    3

    ${resp_2}=    Get Request Capif
    ...    /logs/v1/apiInvocationLogs?aef-id=${register_user_info['aef_id']}&api-invoker-id=${register_user_info_invoker_2['api_invoker_id']}
    ...    verify=ca.crt
    ...    username=${AMF_PROVIDER_USERNAME}

    # Check Results
    Check Response Variable Type And Values    ${resp_2}    200    InvocationLog
    Length Should Be    ${resp_2.json()["logs"]}    2
 No newline at end of file
Loading