Esempio n. 1
0
    def test_no_more_event(self):
        self.obj.chunks = self.obj.more_limiter.chunk('')

        displayMore(self.obj)
        self.obj.delegate.received = []
        
        displayMore(self.obj)
        assert self.obj.delegate.received == [NoMoreEvent()]
Esempio n. 2
0
    def test_no_more_event(self):
        self.obj.chunks = self.obj.more_limiter.chunk('')

        displayMore(self.obj)
        self.obj.delegate.received = []

        displayMore(self.obj)
        assert self.obj.delegate.received == [NoMoreEvent()]
Esempio n. 3
0
 def delegate_event(self, event):
     """Collapse an event to text."""
     logging.debug("Handling event %r." % event)
     event.collapseToText(self, self.avatar)
     if self.chunking:
         bigchunk = self.target.getvalue()
         self.avatar.chunks = self.avatar.more_limiter.chunk(bigchunk)
         self.avatar.chunked_event = event
         self.chunking = False
         self.target = self.telnet
         displayMore(self.avatar)
Esempio n. 4
0
 def delegate_event(self, event):
     """Collapse an event to text."""
     logging.debug("Handling event %r." % event)
     event.collapseToText(self, self.avatar)
     if self.chunking:
         bigchunk = self.target.getvalue()
         self.avatar.chunks = self.avatar.more_limiter.chunk(bigchunk)
         self.avatar.chunked_event = event
         self.chunking = False
         self.target = self.telnet
         displayMore(self.avatar)
Esempio n. 5
0
    def test_more_event(self):
        data = "foo\n" * 29
        self.obj.chunks = self.obj.more_limiter.chunk(data)

        displayMore(self.obj)
        assert self.obj.delegate.received == [MoreEvent('foo\n' * 10, 30, 20)]
        self.obj.delegate.received = []
        displayMore(self.obj)
        assert self.obj.delegate.received == [MoreEvent('foo\n' * 10, 30, 10)]
        self.obj.delegate.received = []
        displayMore(self.obj)
        assert self.obj.delegate.received == [MoreEvent('foo\n' * 9, 30, 0)]
        self.obj.delegate.received = []
Esempio n. 6
0
 def test_more_event(self):
     data = "foo\n" * 29
     self.obj.chunks = self.obj.more_limiter.chunk(data)
     
     displayMore(self.obj)
     assert self.obj.delegate.received == [MoreEvent('foo\n' * 10,
                                                     30, 20)]
     self.obj.delegate.received = []
     displayMore(self.obj)
     assert self.obj.delegate.received == [MoreEvent('foo\n' * 10,
                                                     30, 10)]
     self.obj.delegate.received = []
     displayMore(self.obj)
     assert self.obj.delegate.received == [MoreEvent('foo\n' * 9,
                                                     30, 0)]
     self.obj.delegate.received = []