'L{SSHChannel.sendRequest} can open a shell with a I{pty-req} request,
specifying a terminal type and window size.'

def test_shell(self):

    channel = self._ourServerOurClientTest()
    data = session.packRequest_pty_req('conch-test-term', (24, 80, 0, 0), '')
    def cbChannel(channel):
        self.channel = channel
        return channel.conn.sendRequest(channel, 'pty-req', data, 1)
    channel.addCallback(cbChannel)
    def cbPty(ignored):
        session = self.realm.avatar.conn.channels[0].session
        self.assertIs(session.avatar, self.realm.avatar)
        self.assertEqual(session._terminalType, 'conch-test-term')
        self.assertEqual(session._windowSize, (24, 80, 0, 0))
        self.assertTrue(session.ptyReq)
        channel = self.channel
        return channel.conn.sendRequest(channel, 'shell', '', 1)
    channel.addCallback(cbPty)
    def cbShell(ignored):
        self.channel.write('testing    the    shell!\x00')
        self.channel.conn.sendEOF(self.channel)
        return defer.gatherResults([self.channel.onClose, self.realm.avatar._testSession.onClose])
    channel.addCallback(cbShell)
    def cbExited(ignored):
        if (self.channel.status != 0):
            log.msg(('shell    exit    status    was    not    0:    %i' % (self.channel.status,)))
        self.assertEqual(''.join(self.channel.received), 'testing    the    shell!\x00\r\n')
        self.assertTrue(self.channel.eofCalled)
        self.assertTrue(self.realm.avatar._testSession.eof)
    channel.addCallback(cbExited)
    return channel
