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()
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"), ]
def test_get_command_handler_no_handling_function(repl: Riposte): with pytest.raises(RiposteException): repl._get_command("bar")
def test_get_command(repl: Riposte, foo_command): assert repl._get_command("foo") == foo_command