Ticket #5311: 5311.diff

File 5311.diff, 1.7 KB (added by Itamar Turner-Trauring, 11 years ago)
  • twisted/protocols/test/test_tls.py

     
    142142
    143143
    144144class TLSMemoryBIOFactoryTests(TestCase):
     145    """
     146    Ensure TLSMemoryBIOFactory logging acts correctly.
     147    """
     148
     149    def test_quiet(self):
     150        """
     151        L{TLSMemoryBIOFactory.doStart} and L{TLSMemoryBIOFactory.doStop} do
     152        not log any messages.
     153        """
     154        logs = []
     155        logger = logs.append
     156        log.addObserver(logger)
     157        self.addCleanup(log.removeObserver, logger)
     158        wrappedFactory = ServerFactory()
     159        # Disable logging on the wrapped factory:
     160        wrappedFactory.doStart = lambda: None
     161        wrappedFactory.doStop = lambda: None
     162        factory = TLSMemoryBIOFactory(None, False, wrappedFactory)
     163        factory.doStart()
     164        factory.doStop()
     165        self.assertEqual(logs, [])
     166
     167
    145168    def test_logPrefix(self):
    146169        """
    147170        L{TLSMemoryBIOFactory.logPrefix} amends the wrapped factory's log prefix
  • twisted/protocols/tls.py

     
    577577    """
    578578    protocol = TLSMemoryBIOProtocol
    579579
     580    noisy = False  # disable unnecessary logging.
     581   
    580582    def __init__(self, contextFactory, isClient, wrappedFactory):
    581583        WrappingFactory.__init__(self, wrappedFactory)
    582584        self._contextFactory = contextFactory