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")
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")
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)
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)