From 554940d7ba517a71f003a08342139c3f403e7d82 Mon Sep 17 00:00:00 2001 From: Richard Newman Date: Sat, 15 Oct 2011 15:29:11 -0700 Subject: [PATCH] Bug 694657 - Part 1: Sync: test JS server 404 for GET on missing WBO. r=philikon --- services/sync/tests/unit/head_http_server.js | 4 +++ .../sync/tests/unit/test_httpd_sync_server.js | 27 +++++++++++++------ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/services/sync/tests/unit/head_http_server.js b/services/sync/tests/unit/head_http_server.js index 6e41c5d81fd..26094c15525 100644 --- a/services/sync/tests/unit/head_http_server.js +++ b/services/sync/tests/unit/head_http_server.js @@ -878,6 +878,10 @@ SyncServer.prototype = { switch (req.method) { case "GET": if (!coll) { + if (wboID) { + respond(404, "Not found", "Not found"); + return; + } // *cries inside*: Bug 687299. respond(200, "OK", "[]"); return; diff --git a/services/sync/tests/unit/test_httpd_sync_server.js b/services/sync/tests/unit/test_httpd_sync_server.js index 1403a822539..775f0f89fef 100644 --- a/services/sync/tests/unit/test_httpd_sync_server.js +++ b/services/sync/tests/unit/test_httpd_sync_server.js @@ -203,14 +203,25 @@ add_test(function test_storage_request() { Utils.nextTick(next); }); } - server.start(8080, function () { - retrieveWBONotExists( - retrieveWBOExists.bind(this, - getStorageFails.bind(this, - deleteStorage.bind(this, function () { - server.stop(run_next_test); - })))); - }); + function getMissingCollectionWBO(next) { + _("Testing that fetching a WBO from an on-existent collection 404s."); + let req = localRequest(storageURL + "/foobar/baz"); + req.get(function (err) { + do_check_eq(this.response.status, 404); + Utils.nextTick(next); + }); + } + + server.start(8080, + Async.chain( + retrieveWBONotExists, + retrieveWBOExists, + getStorageFails, + getMissingCollectionWBO, + deleteStorage, + server.stop.bind(server), + run_next_test + )); }); add_test(function test_x_weave_records() {