From: Brian Warner Date: Tue, 17 Jul 2007 19:28:29 +0000 (-0700) Subject: webish: improve test coverage further X-Git-Url: https://git.rkrishnan.org/pf/content/en/footer/CLI.txt?a=commitdiff_plain;h=a7f04616bf58b26b15756fe7bf29d7802581c02d;p=tahoe-lafs%2Ftahoe-lafs.git webish: improve test coverage further --- diff --git a/src/allmydata/test/test_web.py b/src/allmydata/test/test_web.py index f90cb6da..b6182949 100644 --- a/src/allmydata/test/test_web.py +++ b/src/allmydata/test/test_web.py @@ -373,6 +373,11 @@ class Web(unittest.TestCase): d.addCallback(self.failUnlessIsBarDotTxt) return d + def test_GET_FILEURL_download(self): # YES + d = self.GET("/vdrive/global/foo/bar.txt?t=download") + d.addCallback(self.failUnlessIsBarDotTxt) + return d + def test_GET_FILEURL_missing(self): # YES d = self.GET("/vdrive/global/foo/missing") d.addBoth(self.should404, "test_GET_FILEURL_missing") @@ -697,6 +702,18 @@ class Web(unittest.TestCase): d.addCallback(_check) return d + def test_GET_DIRURL_localdir_nonabsolute(self): # YES + localdir = "web/nonabsolute/dirpath" + fileutil.make_dirs("web/nonabsolute") + d = self.GET("/vdrive/global/foo?t=download&localdir=%s" % localdir) + d.addBoth(self.shouldFail, error.Error, "localdir non-absolute", + "403 Forbidden", + "localfile= or localdir= requires an absolute path") + def _check(res): + self.failIf(os.path.exists(localdir)) + d.addCallback(_check) + return d + def touch(self, localdir, filename): path = os.path.join(localdir, filename) f = open(path, "w") diff --git a/src/allmydata/webish.py b/src/allmydata/webish.py index 0dee3288..f8712cd4 100644 --- a/src/allmydata/webish.py +++ b/src/allmydata/webish.py @@ -275,9 +275,6 @@ LOCALHOST = "127.0.0.1" class NeedLocalhostError: implements(inevow.IResource) - def locateChild(self, ctx, segments): - return rend.NotFound - def renderHTTP(self, ctx): req = inevow.IRequest(ctx) req.setResponseCode(http.FORBIDDEN) @@ -287,9 +284,6 @@ class NeedLocalhostError: class NeedAbsolutePathError: implements(inevow.IResource) - def locateChild(self, ctx, segments): - return rend.NotFound - def renderHTTP(self, ctx): req = inevow.IRequest(ctx) req.setResponseCode(http.FORBIDDEN)