def test_lookupSessionChannel(self): """ L{ShellAccount.lookupChannel} returns an L{SSHSession} instance. (This is because L{SSHSession} implements handlers for the standard SSH requests issued to set up a shell.) """ avatar = IConchUser(self.store) channel = avatar.lookupChannel('session', 65536, 16384, '') self.assertTrue(isinstance(channel, SSHSession))
def openShell(self, proto): """Open a shell. """ self.chained_protocol = UrwidServerProtocol(UrwidTerminalProtocol, IUrwidMind(self.original)) TerminalSessionTransport(proto, self.chained_protocol, IConchUser(self.original), self.height, self.width)
def test_interfaces(self): """ L{ShellAccount} powers up the item on which it is installed for L{IConchUser} and the L{IConchUser} powerup is adaptable to L{ISession}. """ avatar = IConchUser(self.store) self.assertTrue(verifyObject(IConchUser, avatar)) session = ISession(avatar) self.assertTrue(verifyObject(ISession, session))
def test_openShell(self): """ The L{ISession} adapter of the L{IConchUser} powerup implements C{openShell} so as to associate the given L{IProcessProtocol} with a transport. """ proto = ProcessProtocol() session = ISession(IConchUser(self.store)) # XXX See Twisted ticket #3864 proto.session = session proto.write = lambda bytes: None # XXX See #2895. session.getPty(None, (123, 456, 789, 1000), None) session.openShell(proto) self.assertNotIdentical(proto.transport, None)
def avatar(self): return IConchUser(self.original)