Bug 810053 - Add explicit test for obsolete document deletion; r=rnewman

This commit is contained in:
Gregory Szorc 2012-11-08 15:24:56 -08:00
parent c7d86737ae
commit 6ec7e06edf
2 changed files with 17 additions and 0 deletions

View File

@ -273,6 +273,7 @@ BagheeraServer.prototype = {
if (request.hasHeader("X-Obsolete-Document")) {
let obsolete = request.getHeader("X-Obsolete-Document");
this._log.info("Deleting from X-Obsolete-Document header: " + obsolete);
delete this.namespaces[namespace][obsolete];
}

View File

@ -72,6 +72,22 @@ add_test(function test_post_json_bad_data() {
});
});
add_test(function test_post_json_delete_obsolete() {
let [client, server] = getClientAndServer();
server.createNamespace("foo");
server.setDocument("foo", "obsolete", "Old payload");
let promise = client.uploadJSON("foo", "new", {foo: "bar"}, "obsolete");
promise.then(function onSuccess(result) {
do_check_true(result.transportSuccess);
do_check_true(result.serverSuccess);
do_check_true(server.hasDocument("foo", "new"));
do_check_false(server.hasDocument("foo", "obsolete"));
server.stop(run_next_test);
});
});
add_test(function test_delete_document() {
let [client, server] = getClientAndServer();