コード例 #1
0
ファイル: test_core.py プロジェクト: nicolasmesa/context-cli
def test_build_pipeline_no_filters(not_empty_filter_mock):
    context_factory = mock.MagicMock()
    args = mock.MagicMock()

    pipeline = build_pipeline(context_factory, args)
    assert not_empty_filter_mock.return_value is pipeline
    not_empty_filter_mock.assert_called_once_with(
        context_generator=context_factory)
コード例 #2
0
ファイル: test_core.py プロジェクト: nicolasmesa/context-cli
def test_build_pipeline_contains_regex_line_filter(
        not_empty_filter_mock, contains_regex_line_filter_mock):
    context_factory = mock.MagicMock()
    args = mock.MagicMock()
    args.line_contains_regex = ['regex']

    pipeline = build_pipeline(context_factory, args)
    assert not_empty_filter_mock.return_value is pipeline
    contains_regex_line_filter_mock.assert_called_once_with(
        context_generator=context_factory, regexp=args.line_contains_regex[0])
    not_empty_filter_mock.assert_called_once_with(
        context_generator=contains_regex_line_filter_mock.return_value)
コード例 #3
0
ファイル: test_core.py プロジェクト: nicolasmesa/context-cli
def test_build_pipeline_not_contains_text_line_filter(
        not_empty_filter_mock, not_contains_text_line_filter_mock):
    context_factory = mock.MagicMock()
    args = mock.MagicMock()
    args.not_line_contains_text = ['not contains this']

    pipeline = build_pipeline(context_factory, args)
    assert not_empty_filter_mock.return_value is pipeline
    not_contains_text_line_filter_mock.assert_called_once_with(
        context_generator=context_factory, text=args.not_line_contains_text[0])
    not_empty_filter_mock.assert_called_once_with(
        context_generator=not_contains_text_line_filter_mock.return_value)
コード例 #4
0
ファイル: test_core.py プロジェクト: nicolasmesa/context-cli
def test_build_pipeline_matches_text_filter(not_empty_filter_mock,
                                            matches_text_filter_mock):
    context_factory = mock.MagicMock()
    args = mock.MagicMock()
    args.matches_text = ['matches this']

    pipeline = build_pipeline(context_factory, args)
    assert not_empty_filter_mock.return_value is pipeline
    matches_text_filter_mock.assert_called_once_with(
        context_generator=context_factory, text=args.matches_text[0])
    not_empty_filter_mock.assert_called_once_with(
        context_generator=matches_text_filter_mock.return_value)