コード例 #1
0
def test_parse_cli_arguments_prompt(repl: Riposte):
    arguments = mock.Mock(c="", file="")
    repl.parser.parse_args = mock.Mock(return_value=arguments)

    repl.parse_cli_arguments()

    assert repl.input_stream.gi_code is input_streams.prompt_input.__code__
コード例 #2
0
def test_parse_cli_arguments_cli(mocked_input_streams, repl: Riposte):
    arguments = mock.Mock(c="foo bar", file="")
    repl.parser.parse_args = mock.Mock(return_value=arguments)

    repl.parse_cli_arguments()

    mocked_input_streams.cli_input.assert_called_once_with(arguments.c)
    assert repl.input_stream is mocked_input_streams.cli_input.return_value
コード例 #3
0
def test_banner_alternative_stream(mocked_print, repl: Riposte):
    repl.banner = "foobar"
    repl.print_banner = False
    repl._process = mock.Mock(side_effect=StopIteration)
    repl.parse_cli_arguments = mock.Mock()

    repl.run()

    mocked_print.assert_not_called()
コード例 #4
0
def test_banner(mocked_print, repl: Riposte):
    repl.banner = "foobar"
    repl.print_banner = True
    repl._process = mock.Mock(side_effect=StopIteration)
    repl.parse_cli_arguments = mock.Mock()

    repl.run()

    mocked_print.assert_called_once_with(repl.banner)