コード例 #1
0
 def test_notFoundChild(self):
     """
     L{twcgi.CGIDirectory.getChild} returns a resource which renders an
     response with the HTTP I{NOT FOUND} status code if the indicated child
     does not exist as an entry in the directory used to initialized the
     L{twcgi.CGIDirectory}.
     """
     path = self.mktemp()
     os.makedirs(path)
     resource = twcgi.CGIDirectory(path)
     request = DummyRequest(['foo'])
     child = resource.getChild("foo", request)
     d = _render(child, request)
     def cbRendered(ignored):
         self.assertEqual(request.responseCode, NOT_FOUND)
     d.addCallback(cbRendered)
     return d
コード例 #2
0
 def test_notFoundChild(self):
     """
     L{twcgi.CGIDirectory.getChild} returns a resource which renders an
     response with the HTTP I{NOT FOUND} status code if the indicated child
     does not exist as an entry in the directory used to initialized the
     L{twcgi.CGIDirectory}.
     """
     path = self.mktemp()
     os.makedirs(path)
     resource = twcgi.CGIDirectory(path)
     request = DummyRequest(['foo'])
     child = resource.getChild("foo", request)
     d = _render(child, request)
     def cbRendered(ignored):
         self.assertEqual(request.responseCode, NOT_FOUND)
     d.addCallback(cbRendered)
     return d
コード例 #3
0
ファイル: resource_test.py プロジェクト: FxYzhu/Tron
 def test_getChild_missing_job(self, resource):
     child = resource.getChild(b"bar", mock.Mock())
     assert isinstance(child, twisted.web.resource.NoResource)
コード例 #4
0
ファイル: resource_test.py プロジェクト: FxYzhu/Tron
 def test_getChild(self, resource):
     child = resource.getChild(b"testname", mock.Mock())
     assert isinstance(child, www.JobResource)