def METHOD_NAME(
    engagement_manager: EngagementManager,
    engagement: EngagementWithCredentials,
    client_configuration: QCSClientConfiguration,
) -> EngagementWithCredentials:
    mock_engagement(client_configuration=client_configuration, engagement=engagement)
    if engagement.endpoint_id == DEFAULT_ENDPOINT_ID:
        endpoint_id = None
    else:
        endpoint_id = engagement.endpoint_id
    cached_engagement = engagement_manager.get_engagement(
        quantum_processor_id=engagement.quantum_processor_ids[0], endpoint_id=endpoint_id
    )
    assert cached_engagement == engagement
    return cached_engagement