diff --git a/src/wormhole_transit_relay/test/common.py b/src/wormhole_transit_relay/test/common.py index 5bdbcba..9f2e827 100644 --- a/src/wormhole_transit_relay/test/common.py +++ b/src/wormhole_transit_relay/test/common.py @@ -4,10 +4,17 @@ from twisted.internet.defer import inlineCallbacks from ..transit_server import Transit class ServerBase: + log_requests = False + @inlineCallbacks def setUp(self): self._lp = None - yield self._setup_relay() + if self.log_requests: + blur_usage = None + else: + blur_usage = 60.0 + yield self._setup_relay(blur_usage=blur_usage) + self._transit_server._debug_log = self.log_requests @inlineCallbacks def _setup_relay(self, blur_usage=None, log_file=None, usage_db=None): diff --git a/src/wormhole_transit_relay/test/test_transit_server.py b/src/wormhole_transit_relay/test/test_transit_server.py index beaec7a..10755ca 100644 --- a/src/wormhole_transit_relay/test/test_transit_server.py +++ b/src/wormhole_transit_relay/test/test_transit_server.py @@ -31,7 +31,7 @@ class Accumulator(protocol.Protocol): self._wait.errback(RuntimeError("closed")) self._disconnect.callback(None) -class Transit(ServerBase, unittest.TestCase): +class _Transit: def test_blur_size(self): blur = transit_server.blur_size self.failUnlessEqual(blur(0), 0) @@ -372,3 +372,9 @@ class Transit(ServerBase, unittest.TestCase): self.assertEqual(a1.data, exp) a1.transport.loseConnection() + +class TransitWithLogs(_Transit, ServerBase, unittest.TestCase): + log_requests = True + +class TransitWithoutLogs(_Transit, ServerBase, unittest.TestCase): + log_requests = False