summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2011-03-28 14:00:53 +0000
committerJan Lehnardt <jan@apache.org>2011-03-28 14:00:53 +0000
commit2e632b8f61b7ad032845186874498d2c8bc356ef (patch)
tree973543e9add202c183ee2a984dbac0d7d89ade59 /share
parent65a6a95c361385f14757c3adf80b84d7817a0ac2 (diff)
Fix function signature mismatch. Allow purging of single revisions in a conflicted
document. Closes COUCHDB-1065 Patch by Randall Leeds, verified by Robert Dionne. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1086240 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share')
-rw-r--r--share/www/script/test/purge.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/share/www/script/test/purge.js b/share/www/script/test/purge.js
index f8f45138..29689137 100644
--- a/share/www/script/test/purge.js
+++ b/share/www/script/test/purge.js
@@ -110,4 +110,36 @@ couchTests.purge = function(debug) {
T(rows[(2*(i-4))+1].key == i+1);
}
T(db.view("test/single_doc").total_rows == 0);
+
+ // COUCHDB-1065
+ var dbA = new CouchDB("test_suite_db_a");
+ var dbB = new CouchDB("test_suite_db_b");
+ dbA.deleteDb();
+ dbA.createDb();
+ dbB.deleteDb();
+ dbB.createDb();
+ var docA = {_id:"test", a:1};
+ var docB = {_id:"test", a:2};
+ dbA.save(docA);
+ dbB.save(docB);
+ CouchDB.replicate(dbA.name, dbB.name);
+ var xhr = CouchDB.request("POST", "/" + dbB.name + "/_purge", {
+ body: JSON.stringify({"test":[docA._rev]})
+ });
+ TEquals(200, xhr.status, "single rev purge after replication succeeds");
+
+ var xhr = CouchDB.request("GET", "/" + dbB.name + "/test?rev=" + docA._rev);
+ TEquals(404, xhr.status, "single rev purge removes revision");
+
+ var xhr = CouchDB.request("POST", "/" + dbB.name + "/_purge", {
+ body: JSON.stringify({"test":[docB._rev]})
+ });
+ TEquals(200, xhr.status, "single rev purge after replication succeeds");
+ var xhr = CouchDB.request("GET", "/" + dbB.name + "/test?rev=" + docB._rev);
+ TEquals(404, xhr.status, "single rev purge removes revision");
+
+ var xhr = CouchDB.request("POST", "/" + dbB.name + "/_purge", {
+ body: JSON.stringify({"test":[docA._rev, docB._rev]})
+ });
+ TEquals(200, xhr.status, "all rev purge after replication succeeds");
};