def test_requestWindowChange(self):
     """
     When the client requests to change the window size, the SSHSession
     object should make the request by getting an ISession adapter for the
     avatar, then calling windowChanged with the new window size.
     """
     ret = self.session.requestReceived(b"window_change", session.packRequest_window_change((0, 0, 0, 0)))
     self.assertFalse(ret)
     self.assertRequestRaisedRuntimeError()
     self.assertSessionIsStubSession()
     self.assertTrue(self.session.requestReceived(b"window_change", session.packRequest_window_change((1, 2, 3, 4))))
     self.assertEqual(self.session.session.windowChange, (1, 2, 3, 4))
Пример #2
0
 def test_requestWindowChange(self):
     """
     When the client requests to change the window size, the SSHSession
     object should make the request by getting an ISession adapter for the
     avatar, then calling windowChanged with the new window size.
     """
     ret = self.session.requestReceived(
         'window_change', session.packRequest_window_change((0, 0, 0, 0)))
     self.assertFalse(ret)
     self.assertRequestRaisedRuntimeError()
     self.assertSessionIsStubSession()
     self.assertTrue(
         self.session.requestReceived(
             'window_change', session.packRequest_window_change(
                 (1, 2, 3, 4))))
     self.assertEquals(self.session.session.windowChange, (1, 2, 3, 4))
 def test_requestWindowChangeGetsSession(self):
     """
     If an ISession adapter isn't already present, request_window_change
     should get one.
     """
     self.session.requestReceived(b"window_change", session.packRequest_window_change((1, 1, 1, 1)))
     self.assertSessionProvidesISession()
Пример #4
0
 def test_requestWindowChangeGetsSession(self):
     """
     If an ISession adapter isn't already present, request_window_change
     should get one.
     """
     self.session.requestReceived(
         'window_change', session.packRequest_window_change((1, 1, 1, 1)))
     self.assertSessionProvidesISession()
Пример #5
0
 def test_packRequest_window_change(self):
     """
     See test_parseRequest_window_change for the payload format.
     """
     self.assertEqual(
         session.packRequest_window_change((2, 1, 3, 4)),
         struct.pack(">4L", 1, 2, 3, 4),
     )
Пример #6
0
    def updateWindowSize(self):
        time_diff = float(time.time() - self.last_update)
        if time_diff < 1 and not self.queue_call:
            reactor.callLater(time_diff, self.updateWindowSize)
            self.queue_call = True
            return

        self.queue_call = False
        self.last_update = time.time()
        self.conn.sendRequest(self, 'window-change', session.packRequest_window_change(self.window_size))
Пример #7
0
    def updateWindowSize(self):
        time_diff = float(time.time() - self.last_update)
        if time_diff < 1 and not self.queue_call:
            reactor.callLater(time_diff, self.updateWindowSize)
            self.queue_call = True
            return

        self.queue_call = False
        self.last_update = time.time()
        self.conn.sendRequest(
            self, 'window-change',
            session.packRequest_window_change(self.window_size))
Пример #8
0
 def terminalSize(self, width, height):
     data = session.packRequest_window_change((height, width, 0, 0))
     self.conn.sendRequest(self, 'window-change', data, wantReply=0)
 def test_packRequest_window_change(self):
     """
     See test_parseRequest_window_change for the payload format.
     """
     self.assertEqual(session.packRequest_window_change((2, 1, 3, 4)), struct.pack(">4L", 1, 2, 3, 4))
Пример #10
0
 def terminalSize(self, width, height):
     data = session.packRequest_window_change((height, width, 0, 0))
     self.conn.sendRequest(self, 'window-change', data, wantReply=0)