d = self.PUT("/vdrive/global/foo/blockingfile/new.txt",
self.NEWFILE_CONTENTS)
d.addBoth(self.shouldFail, error.Error, "PUT_NEWFILEURL_blocked",
- "403 Forbidden")
+ "400 Bad Request",
+ "cannot create directory because there is a file in the way")
return d
def test_DELETE_FILEURL(self): # YES
d = self.GET("/vdrive/global/foo/bar.txt?t=download&localfile=%s"
% localfile)
d.addBoth(self.shouldFail, error.Error, "localfile non-local",
- "403 Forbidden")
+ "403 Forbidden",
+ "localfile= or localdir= requires a local connection")
def _check(res):
self.failIf(os.path.exists(localfile))
d.addCallback(_check)
d = self.GET("/vdrive/global/foo/bar.txt?t=download&localfile=%s"
% localfile)
d.addBoth(self.shouldFail, error.Error, "localfile non-absolute",
- "403 Forbidden")
+ "403 Forbidden",
+ "localfile= or localdir= requires an absolute path")
def _check(res):
self.failIf(os.path.exists(localfile))
d.addCallback(_check)
d.addCallback(self._upload_file, req.content, name)
def _check_blocking(f):
f.trap(BlockingFileError)
- req.setResponseCode(http.FORBIDDEN)
+ req.setResponseCode(http.BAD_REQUEST)
req.setHeader("content-type", "text/plain")
- return str(f)
+ return str(f.value)
d.addErrback(_check_blocking)
return d
def _get_or_create_directories(self, node, path):
if not IDirectoryNode.providedBy(node):
- raise BlockingFileError
+ # unfortunately it is too late to provide the name of the
+ # blocking directory in the error message.
+ raise BlockingFileError("cannot create directory because there "
+ "is a file in the way")
if not path:
return defer.succeed(node)
d = node.get(path[0])