Implemented DELETE and listFiles on fake DAV so that test_service doesn't raise an exception.
Implemented DELETE and listFiles on fake DAV so that test_service doesn't raise an exception.
--- a/services/sync/tests/unit/head_first.js
+++ b/services/sync/tests/unit/head_first.js
@@ -190,16 +190,39 @@ FakeDAVService.prototype = {
getTestLogger().info("HTTP GET from " + path + ", returning status " +
result.status);
return makeFakeAsyncFunc(result).async(this, onComplete);
},
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);
}
};
function FakePasswordService(contents) {
Cu.import("resource://weave/util.js");
this.fakeContents = contents;
let self = this;