Commit f319d93f authored by Jorge Moratinos's avatar Jorge Moratinos
Browse files

New test on auditing api testplan

parent 08b49f82
Loading
Loading
Loading
Loading
Loading
+82 −0
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