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)
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"