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
def test_getChild_missing_job(self, resource): child = resource.getChild(b"bar", mock.Mock()) assert isinstance(child, twisted.web.resource.NoResource)
def test_getChild(self, resource): child = resource.getChild(b"testname", mock.Mock()) assert isinstance(child, www.JobResource)