Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B260D85F2 for ; Fri, 9 Sep 2011 03:43:15 +0000 (UTC) Received: (qmail 19629 invoked by uid 500); 9 Sep 2011 03:43:07 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 19502 invoked by uid 500); 9 Sep 2011 03:42:51 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 19472 invoked by uid 99); 9 Sep 2011 03:42:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 03:42:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 03:42:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 5F58223889B3 for ; Fri, 9 Sep 2011 03:42:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1166980 - /couchdb/trunk/share/www/script/test/conflicts.js Date: Fri, 09 Sep 2011 03:42:23 -0000 To: commits@couchdb.apache.org From: randall@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110909034223.5F58223889B3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: randall Date: Fri Sep 9 03:42:22 2011 New Revision: 1166980 URL: http://svn.apache.org/viewvc?rev=1166980&view=rev Log: js test cases to exercise COUCHDB-1268 Modified: couchdb/trunk/share/www/script/test/conflicts.js Modified: couchdb/trunk/share/www/script/test/conflicts.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/conflicts.js?rev=1166980&r1=1166979&r2=1166980&view=diff ============================================================================== --- couchdb/trunk/share/www/script/test/conflicts.js (original) +++ couchdb/trunk/share/www/script/test/conflicts.js Fri Sep 9 03:42:22 2011 @@ -56,6 +56,36 @@ couchTests.conflicts = function(debug) { T(e.error == "conflict"); } + // Make a few bad requests, specifying conflicting revs + // ?rev doesn't match body + var xhr = CouchDB.request("PUT", "/test_suite_db/foo?rev=1-foobar", { + body : JSON.stringify(doc) + }); + T(xhr.status == 400); + + // If-Match doesn't match body + xhr = CouchDB.request("PUT", "/test_suite_db/foo", { + headers: {"If-Match": "1-foobar"}, + body: JSON.stringify(doc) + }); + T(xhr.status == 400); + + // ?rev= doesn't match If-Match + xhr = CouchDB.request("PUT", "/test_suite_db/foo?rev=1-boobaz", { + headers: {"If-Match": "1-foobar"}, + body: JSON.stringify(doc2) + }); + T(xhr.status == 400); + + // Now update the document using ?rev= + xhr = CouchDB.request("PUT", "/test_suite_db/foo?rev=" + doc._rev, { + body: JSON.stringify(doc) + }); + T(xhr.status == 201); + + // reopen + var doc = db.open(doc._id); + // Now delete the document from the database T(db.deleteDoc(doc).ok);