Example #1
0
 def test_writer_flush_error(self):
     s = BytesIO()
     s = tcp.Writer(s)
     o = mock.MagicMock()
     o.flush = mock.MagicMock(side_effect=socket.error)
     s.o = o
     tutils.raises(exceptions.TcpDisconnect, s.flush)
Example #2
0
 def test_writelog(self):
     s = BytesIO()
     s = tcp.Writer(s)
     s.start_log()
     assert s.is_logging()
     s.write(b"x")
     assert s.get_log() == b"x"
     s.write(b"x")
     assert s.get_log() == b"xx"