コード例 #1
0
def test_main(
    mock_get_docker_client,
    mock_log_to_paasta,
    mock_log_to_clog,
    mock_load_system_paasta_config,
    mock_send_sfx_event,
    mock_clog,
    mock_sys_stdin,
    sys_stdin,
    docker_inspect,
    log_line,
):

    mock_sys_stdin.readline.side_effect = sys_stdin
    docker_client = Mock(inspect_container=Mock(return_value=docker_inspect))
    mock_get_docker_client.return_value = docker_client
    mock_load_system_paasta_config.return_value.get_cluster.return_value = (
        "fake_cluster"
    )

    main()
    mock_log_to_paasta.assert_called_once_with(log_line)
    mock_log_to_clog.assert_called_once_with(log_line)
    mock_send_sfx_event.assert_called_once_with(
        "fake_service", "fake_instance", "fake_cluster"
    )
コード例 #2
0
ファイル: test_oom_logger.py プロジェクト: white105/paasta
def test_main(
    mock_get_docker_client,
    mock_log_to_paasta,
    mock_log_to_scribe,
    mock_load_system_paasta_config,
    mock_scribelogger,
    mock_sys_stdin,
    sys_stdin,
    docker_inspect,
    log_line,
):

    mock_sys_stdin.readline.side_effect = sys_stdin
    docker_client = Mock(inspect_container=Mock(return_value=docker_inspect))
    mock_get_docker_client.return_value = docker_client
    mock_load_system_paasta_config.return_value.get_cluster.return_value = 'fake_cluster'
    scribe_logger = Mock()
    mock_scribelogger.return_value = scribe_logger

    main()
    mock_log_to_paasta.assert_called_once_with(log_line)
    mock_log_to_scribe.assert_called_once_with(scribe_logger, log_line)