Skip to content

Commit

Permalink
Mock annoying twisted HTTPChannel.timeoutConnection log
Browse files Browse the repository at this point in the history
  • Loading branch information
evilaliv3 committed Jun 1, 2017
1 parent de09f2b commit 686a402
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/globaleaks/mocks/twisted_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from io import BytesIO as StringIO

from twisted.internet import defer
from twisted.protocols import policies
from twisted.web.client import HTTPPageGetter
from twisted.web.http import HTTPFactory, Request
from twisted.web.http import HTTPChannel, HTTPFactory, Request

from globaleaks.settings import GLSettings
from globaleaks.security import GLSecureTemporaryFile
Expand Down Expand Up @@ -49,7 +50,16 @@ def timeout(self):
self.factory.noPage(defer.TimeoutError("Getting %s took longer than %s seconds." % (self.factory.url, self.factory.timeout)))


def mock_HTTChannel__timeoutConnection(self):
"""
This mock is required to just comment a log line
"""
# log.msg("Timing out client: %s" % str(self.transport.getPeer()))
policies.TimeoutMixin.timeoutConnection(self)


Request.gotLength = mock_Request_gotLength
Request.write = mock_Request_write
HTTPPageGetter.timeout = mock_HTTPPageGetter_timeout
HTTPFactory.__init__ = mock_HTTPFactory__init__
HTTPChannel.timeoutConnection = mock_HTTChannel__timeoutConnection

0 comments on commit 686a402

Please sign in to comment.