From a3886989b9e09ca5d01e18f1e39e9dae0f280530 Mon Sep 17 00:00:00 2001 From: "Damien F. Katz" Date: Fri, 25 Jun 2010 05:18:28 +0000 Subject: Added checking to ensure when a revpos is sent with a stub, it's correct. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@957800 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/attachments.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'share') diff --git a/share/www/script/test/attachments.js b/share/www/script/test/attachments.js index 322a4f50..9d89d5d0 100644 --- a/share/www/script/test/attachments.js +++ b/share/www/script/test/attachments.js @@ -255,13 +255,19 @@ couchTests.attachments= function(debug) { } } } - var save_response = db.save(bin_doc6); - bin_doc6._rev = save_response["rev"]; + T(db.save(bin_doc6).ok); // stub out the attachment bin_doc6._attachments["foo.txt"] = { stub: true }; - - var xhr = CouchDB.request("PUT", "/test_suite_db/bin_doc6", { - body: JSON.stringify(bin_doc6) - }); - TEquals(201, xhr.status, "should send 201 Created when attachment stub contains only the 'stub' field"); + T(db.save(bin_doc6).ok == true); + + // wrong rev pos specified + + // stub out the attachment with the wrong revpos + bin_doc6._attachments["foo.txt"] = { stub: true, revpos: 10}; + try { + T(db.save(bin_doc6).ok == true); + T(false && "Shouldn't get here!"); + } catch (e) { + T(e.error == "missing_stub") + } }; -- cgit v1.2.3