コード例 #1
0
def test_create_log_stream_no_credentials_error(mocker):
    mocker.patch('mount_efs.cloudwatch_create_log_stream_helper',
                 side_effect=[NoCredentialsError()])
    is_completed = mount_efs.create_cloudwatch_log_stream(
        MOCK_AGENT['client'], DEFAULT_CLOUDWATCH_LOG_GROUP,
        DEFAULT_CLOUDWATCH_LOG_STREAM)
    assert is_completed == False
コード例 #2
0
def _test_create_log_stream_client_error(mocker,
                                         exception,
                                         desired_result=False):
    operation_name = 'CreateLogStream'
    response = {'Error': {'Code': exception, 'Message': exception}}
    mocker.patch('mount_efs.cloudwatch_create_log_stream_helper',
                 side_effect=[ClientError(response, operation_name)])
    is_completed = mount_efs.create_cloudwatch_log_stream(
        MOCK_AGENT['client'], DEFAULT_CLOUDWATCH_LOG_GROUP,
        DEFAULT_CLOUDWATCH_LOG_STREAM)
    assert is_completed == desired_result
コード例 #3
0
def _test_create_log_stream_client_error(mocker,
                                         exception,
                                         desired_result=False):
    operation_name = "CreateLogStream"
    response = {"Error": {"Code": exception, "Message": exception}}
    mocker.patch(
        "mount_efs.cloudwatch_create_log_stream_helper",
        side_effect=[ClientError(response, operation_name)],
    )
    is_completed = mount_efs.create_cloudwatch_log_stream(
        MOCK_AGENT["client"],
        DEFAULT_CLOUDWATCH_LOG_GROUP,
        DEFAULT_CLOUDWATCH_LOG_STREAM,
    )
    assert is_completed == desired_result