示例#1
0
def test_process_no_input(mocked_input, repl: Riposte):
    repl._split_inline_commands = mock.MagicMock()
    repl._parse_line = mock.Mock()
    repl._get_command = mock.Mock()

    repl._process()

    repl._split_inline_commands.assert_not_called()
    repl._parse_line.assert_not_called()
    repl._get_command.assert_not_called()
示例#2
0
def test_process_multi_line(mocked_input, repl: Riposte):
    repl._get_command = mock.Mock()

    repl._process()

    assert repl._get_command.call_args_list == [
        mock.call("foo"),
        mock.call("scoo"),
    ]

    assert repl._get_command.return_value.execute.call_args_list == [
        mock.call("bar"),
        mock.call("bee"),
    ]
示例#3
0
def test_get_command_handler_no_handling_function(repl: Riposte):
    with pytest.raises(RiposteException):
        repl._get_command("bar")
示例#4
0
def test_get_command(repl: Riposte, foo_command):
    assert repl._get_command("foo") == foo_command