def getproto(self, request): rfile = BytesIO(request) wfile = BytesIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) return ProtocolMultiplexer.getProtocol(file.readline(), handler.server, handler, handler.rfile, handler.wfile, self.config)
def testlog_proto_ip(self): rfile = BytesIO(b"/NONEXISTANT\n") wfile = BytesIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) handler.handle() # handler.handle() self.assertEqual(self.stringfile.getvalue(), b"10.77.77.77 [GopherProtocol/None] EXCEPTION FileNotFound: '/NONEXISTANT' does not exist (no handler found)\n")
def testlog_proto_ip(self): rfile = StringIO("/NONEXISTANT\n") wfile = StringIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) handler.handle() # handler.handle() self.assertEquals(self.stringfile.getvalue(), "10.77.77.77 [GopherProtocol/None] EXCEPTION FileNotFound: '/NONEXISTANT' does not exist (no handler found)\n")
def setUp(self): self.config = testutil.getconfig() self.rfile = StringIO("/testfile.txt\n") self.wfile = StringIO() self.logfile = testutil.getstringlogger() self.handler = testutil.gettestinghandler(self.rfile, self.wfile, self.config) self.server = self.handler.server self.proto = GopherProtocol("/testfile.txt\n", self.server, self.handler, self.rfile, self.wfile, self.config)
def setUp(self): self.config = testutil.getconfig() self.rfile = BytesIO(b"/testfile.txt\n") self.wfile = BytesIO() self.logfile = testutil.getstringlogger() self.handler = testutil.gettestinghandler(self.rfile, self.wfile, self.config) self.server = self.handler.server self.proto = GopherProtocol("/testfile.txt\n", self.server, self.handler, self.rfile, self.wfile, self.config)
def getproto(self, request): rfile = StringIO(request) wfile = StringIO() handler = testutil.gettestinghandler(rfile, wfile, self.config) return ProtocolMultiplexer.getProtocol(file.readline(), handler.server, handler, handler.rfile, handler.wfile, self.config)
def setUp(self): self.config = testutil.getconfig() self.rfile = StringIO("/testfile.txt\n") self.wfile = StringIO() self.logfile = testutil.getstringlogger() self.logstr = "10.77.77.77 [BaseGopherProtocol/FileHandler]: /testfile.txt\n" self.handler = testutil.gettestinghandler(self.rfile, self.wfile, self.config) self.server = self.handler.server self.proto = BaseGopherProtocol("/testfile.txt\n", self.server, self.handler, self.rfile, self.wfile, self.config)
def setUp(self): from pygopherd import testutil from pygopherd.protocols.rfc1436 import GopherProtocol self.config = testutil.getconfig() self.rfile = StringIO("/testfile.txt\n") self.wfile = StringIO() self.logfile = testutil.getstringlogger() self.handler = testutil.gettestinghandler(self.rfile, self.wfile, self.config) self.server = self.handler.server self.proto = GopherProtocol("/testfile.txt\n", self.server, self.handler, self.rfile, self.wfile, self.config) self.config.set("handlers.ZIP.ZIPHandler", "enabled", 'true') from pygopherd.handlers import HandlerMultiplexer HandlerMultiplexer.handlers = None handlerlist = self.config.get("handlers.HandlerMultiplexer", "handlers") handlerlist = handlerlist.strip() handlerlist = handlerlist[0] + 'ZIP.ZIPHandler, ' + handlerlist[1:] self.config.set("handlers.HandlerMultiplexer", "handlers", handlerlist)