コード例 #1
0
 def setUp(self):
     name = self.mktemp()
     os.mkdir(name)
     FilePath(name).child('file').setContent('0123456789')
     r = static.File(name)
     r.putChild('redirect', util.Redirect('/file'))
     r.putChild('wait', ForeverTakingResource())
     r.putChild('error', ErrorResource())
     r.putChild('nolength', NoLengthResource())
     r.putChild('host', HostHeaderResource())
     r.putChild('payload', PayloadResource())
     r.putChild('broken', BrokenDownloadResource())
     self.site = server.Site(r, timeout=None)
     self.wrapper = WrappingFactory(self.site)
     self.port = self._listen(self.wrapper)
     self.portno = self.port.getHost().port
コード例 #2
0
ファイル: test_webclient.py プロジェクト: reenvs/self-summary
 def setUp(self):
     name = self.mktemp()
     os.mkdir(name)
     FilePath(name).child("file").setContent("0123456789")
     r = static.File(name)
     r.putChild("redirect", util.Redirect("/file"))
     r.putChild("wait", ForeverTakingResource())
     r.putChild("error", ErrorResource())
     r.putChild("nolength", NoLengthResource())
     r.putChild("host", HostHeaderResource())
     r.putChild("payload", PayloadResource())
     r.putChild("broken", BrokenDownloadResource())
     self.site = server.Site(r, timeout=None)
     self.wrapper = WrappingFactory(self.site)
     self.port = self._listen(self.wrapper)
     self.portno = self.port.getHost().port