def test_do_handle_echoes_newline_properly1(self): t = mock.Mock() h = echo.echo(t) self.assertFalse(h.stop) h.do_handle("\n") t.write.assert_called_with("\r\n") self.assertTrue(h.stop)
def __init__(self, transport): super(simple_session, self).__init__(transport) lhandler = buffering.buffering(self.on_line, self.on_abort) ehandler = echo.echo(transport) khandler = keystroke.keystroke() khandler.simpleterm_bindings(transport) self.noecho = False self.ehandler = ehandler self.handler = handler.handler() self.handler.chain_other(khandler).chain(ehandler, lhandler) self.networks = []
def test_do_handle_echoes_char_back(self): t = mock.Mock() h = echo.echo(t) h.do_handle("a") t.write.assert_called_with("a")
def test_do_unhandle(self): t = mock.Mock() h = echo.echo(t) h.do_unhandle() t.write.assert_called_with("\b \b")
def test_do_cancel(self): t = mock.Mock() h = echo.echo(t) h.do_cancel() self.assertEqual([(("^C",),{}), (("\r\n",),{})], t.write.call_args_list)