def test_write(self): """ L{_ReturnToMenuWrapper.write} passes through to the wrapped terminal. """ terminal = FakeTerminal() terminal.makeConnection(None) wrapper = _ReturnToMenuWrapper(None, terminal) wrapper.write('some bytes') wrapper.write('some more') self.assertIn('some bytessome more', str(terminal))
def test_loseConnection(self): """ L{_ReturnToMenuWrapper.loseConnection} does not disconnect the terminal; instead it calls the C{reactivate} method of its C{shell} attribute. """ class FakeShell(object): activated = False def reactivate(self): self.activated = True shell = FakeShell() terminal = FakeTerminal() wrapper = _ReturnToMenuWrapper(shell, terminal) wrapper.loseConnection() self.assertFalse(terminal.disconnected) self.assertTrue(shell.activated)