Implemented DELETE and listFiles on fake DAV so that test_service doesn't raise an exception.

This commit is contained in:
Atul Varma 2008-06-26 17:48:39 -07:00
parent 7127d6d7c8
commit 29f7b89a5a

View File

@ -195,6 +195,29 @@ FakeDAVService.prototype = {
MKCOL: function fake_MKCOL(path, onComplete) {
getTestLogger().info("HTTP MKCOL on " + path);
makeFakeAsyncFunc(true).async(this, onComplete);
},
DELETE: function fake_DELETE(path, onComplete) {
var result = {status: 404};
if (path in this.fakeContents) {
result = {status: 200};
delete this.fakeContents[path];
}
getTestLogger().info("HTTP DELETE on " + path + ", returning status " +
result.status);
return makeFakeAsyncFunc(result).async(this, onComplete);
},
listFiles: function fake_listFiles(path) {
let self = yield;
if (typeof(path) != "undefined")
throw new Error("Not yet implemented!");
let filenames = [];
for (name in this.fakeContents) {
getTestLogger().info("file " + name);
filenames.push(name);
}
self.done(filenames);
}
};