def _test_put_log_events_client_error(mocker, exception, desired_result=False):
    operation_name = 'PutLogEvents'
    response = {'Error': {'Code': exception, 'Message': exception}}

    mocker.patch('mount_efs.get_log_stream_next_token', return_value='ABCDEF')
    mocker.patch('mount_efs.cloudwatch_put_log_events_helper',
                 side_effect=[ClientError(response, operation_name)])
    is_completed = mount_efs.publish_cloudwatch_log(MOCK_AGENT, 'Test')
    assert is_completed == desired_result
Beispiel #2
0
def _test_put_log_events_client_error(mocker, exception, desired_result=False):
    operation_name = "PutLogEvents"
    response = {"Error": {"Code": exception, "Message": exception}}

    mocker.patch("mount_efs.get_log_stream_next_token", return_value="ABCDEF")
    mocker.patch(
        "mount_efs.cloudwatch_put_log_events_helper",
        side_effect=[ClientError(response, operation_name)],
    )
    is_completed = mount_efs.publish_cloudwatch_log(MOCK_AGENT, "Test")
    assert is_completed == desired_result
def test_put_log_events_no_credentials_error(mocker):
    mocker.patch('mount_efs.get_log_stream_next_token', return_value='ABCDEF')
    mocker.patch('mount_efs.cloudwatch_put_log_events_helper',
                 side_effect=[NoCredentialsError()])
    is_completed = mount_efs.publish_cloudwatch_log(MOCK_AGENT, 'Test')
    assert is_completed == False