summaryrefslogtreecommitdiff
path: root/test/javascript/tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/javascript/tests')
-rw-r--r--test/javascript/tests/purge.js4
-rw-r--r--test/javascript/tests/replication.js65
-rw-r--r--test/javascript/tests/rev_stemming.js8
-rw-r--r--test/javascript/tests/users_db.js13
-rw-r--r--test/javascript/tests/view_conflicts.js6
-rw-r--r--test/javascript/tests/view_include_docs.js6
6 files changed, 26 insertions, 76 deletions
diff --git a/test/javascript/tests/purge.js b/test/javascript/tests/purge.js
index 0c11d9ad8..36ea955d6 100644
--- a/test/javascript/tests/purge.js
+++ b/test/javascript/tests/purge.js
@@ -114,7 +114,9 @@ couchTests.purge = function(debug) {
var docB = {_id:"test", a:2};
dbA.save(docA);
dbB.save(docB);
- CouchDB.replicate(dbA.name, dbB.name);
+ var rep_src = CouchDB.protocol + CouchDB.host + "/" + dbA.name;
+ var rep_tgt = CouchDB.protocol + CouchDB.host + "/" + dbB.name;
+ CouchDB.replicate(rep_src, rep_tgt);
var xhr = CouchDB.request("POST", "/" + dbB.name + "/_purge", {
body: JSON.stringify({"test":[docA._rev]})
});
diff --git a/test/javascript/tests/replication.js b/test/javascript/tests/replication.js
index ba586b409..7b2d379e3 100644
--- a/test/javascript/tests/replication.js
+++ b/test/javascript/tests/replication.js
@@ -22,18 +22,6 @@ couchTests.replication = function(debug) {
var dbPairsPrefixes = [
{
- source: "",
- target: ""
- },
- {
- source: CouchDB.protocol + host + "/",
- target: ""
- },
- {
- source: "",
- target: CouchDB.protocol + host + "/"
- },
- {
source: CouchDB.protocol + host + "/",
target: CouchDB.protocol + host + "/"
}
@@ -585,25 +573,10 @@ couchTests.replication = function(debug) {
//TEquals(sourceInfo.update_seq, repResult.source_last_seq);
}
-
- // test error when source database does not exist
- try {
- CouchDB.replicate("foobar", "test_suite_db");
- T(false, "should have failed with db_not_found error");
- } catch (x) {
- TEquals("db_not_found", x.error);
- }
-
- // validate COUCHDB-317
- try {
- CouchDB.replicate("/foobar", "test_suite_db");
- T(false, "should have failed with db_not_found error");
- } catch (x) {
- TEquals("db_not_found", x.error);
- }
-
try {
- CouchDB.replicate(CouchDB.protocol + host + "/foobar", "test_suite_db");
+ var rep_src = CouchDB.protocol + host + "/foobar";
+ var rep_tgt = CouchDB.protocol + host + "/test_suite_db";
+ CouchDB.replicate(rep_src, rep_tgt);
T(false, "should have failed with db_not_found error");
} catch (x) {
TEquals("db_not_found", x.error);
@@ -1591,18 +1564,6 @@ couchTests.replication = function(debug) {
dbPairsPrefixes = [
{
- source: "",
- target: ""
- },
- {
- source: CouchDB.protocol + host + "/",
- target: ""
- },
- {
- source: "",
- target: CouchDB.protocol + "joe:erly@" + host + "/"
- },
- {
source: CouchDB.protocol + host + "/",
target: CouchDB.protocol + "joe:erly@" + host + "/"
}
@@ -1660,18 +1621,6 @@ couchTests.replication = function(debug) {
// case 2) user triggering the replication is not a reader (nor admin) of the source DB
dbPairsPrefixes = [
{
- source: "",
- target: ""
- },
- {
- source: CouchDB.protocol + "joe:erly@" + host + "/",
- target: ""
- },
- {
- source: "",
- target: CouchDB.protocol + host + "/"
- },
- {
source: CouchDB.protocol + "joe:erly@" + host + "/",
target: CouchDB.protocol + host + "/"
}
@@ -1745,7 +1694,7 @@ couchTests.replication = function(debug) {
TEquals(true, sourceDb.save(doc).ok);
repResult = CouchDB.replicate(
- sourceDb.name,
+ CouchDB.protocol + host + "/" + sourceDb.name,
CouchDB.protocol + host + "/" + targetDb.name
);
TEquals(true, repResult.ok);
@@ -1768,7 +1717,7 @@ couchTests.replication = function(debug) {
TEquals(true, sourceDb.save(doc).ok);
repResult = CouchDB.replicate(
- sourceDb.name,
+ CouchDB.protocol + host + "/" + sourceDb.name,
CouchDB.protocol + host + "/" + targetDb.name
);
TEquals(true, repResult.ok);
@@ -1819,7 +1768,7 @@ couchTests.replication = function(debug) {
repResult = CouchDB.replicate(
CouchDB.protocol + host + "/" + sourceDb.name,
- targetDb.name,
+ CouchDB.protocol + host + "/" + sourceDb.name,
{
body: {
continuous: true,
@@ -1880,7 +1829,7 @@ couchTests.replication = function(debug) {
repResult = CouchDB.replicate(
CouchDB.protocol + host + "/" + sourceDb.name,
- targetDb.name,
+ CouchDB.protocol + host + "/" + targetDb.name,
{
body: {
continuous: true
diff --git a/test/javascript/tests/rev_stemming.js b/test/javascript/tests/rev_stemming.js
index 238868f60..13fbdc407 100644
--- a/test/javascript/tests/rev_stemming.js
+++ b/test/javascript/tests/rev_stemming.js
@@ -69,7 +69,9 @@ couchTests.rev_stemming = function(debug) {
// If you replicate after you make more edits than the limit, you'll
// cause a spurious edit conflict.
- CouchDB.replicate(db.name, dbB.name);
+ var rep_src = CouchDB.protocol + CouchDB.host + "/" + db.name;
+ var rep_tgt = CouchDB.protocol + CouchDB.host + "/" + dbB.name;
+ CouchDB.replicate(rep_src, rep_tgt);
var docB1 = dbB.open("foo",{conflicts:true})
T(docB1._conflicts == null);
@@ -79,7 +81,7 @@ couchTests.rev_stemming = function(debug) {
}
// one less edit than limit, no conflict
- CouchDB.replicate(db.name, dbB.name);
+ CouchDB.replicate(rep_src, rep_tgt);
var docB1 = dbB.open("foo",{conflicts:true})
T(docB1._conflicts == null);
@@ -89,7 +91,7 @@ couchTests.rev_stemming = function(debug) {
T(db.save(doc).ok);
}
- CouchDB.replicate(db.name, dbB.name);
+ CouchDB.replicate(rep_src, rep_tgt);
var docB2 = dbB.open("foo",{conflicts:true});
diff --git a/test/javascript/tests/users_db.js b/test/javascript/tests/users_db.js
index 20be325ca..7d9682185 100644
--- a/test/javascript/tests/users_db.js
+++ b/test/javascript/tests/users_db.js
@@ -68,14 +68,13 @@ couchTests.users_db = function(debug) {
CouchDB.logout();
// ok, now create a conflicting edit on the jchris doc, and make sure there's no login.
- // (use replication to create the conflict) - need 2 be admin
CouchDB.login("jan", "apple");
- CouchDB.replicate(usersDb.name, usersDbAlt.name);
- // save in one DB
+ // save using new_edits=false
var jchrisUser2 = JSON.parse(JSON.stringify(jchrisUserDoc));
jchrisUser2.foo = "bar";
+ jchrisUser2._rev = "1-7a28b8e96ee17f723ebc1e9f89640783";
- T(usersDb.save(jchrisUser2).ok);
+ T(usersDb.save(jchrisUser2, {new_edits: false}).ok);
try {
usersDb.save(jchrisUserDoc);
T(false && "should be an update conflict");
@@ -83,12 +82,6 @@ couchTests.users_db = function(debug) {
T(true);
}
- // then in the other
- var jchrisUser3 = JSON.parse(JSON.stringify(jchrisUserDoc));
- jchrisUser3.foo = "barrrr";
- T(usersDbAlt.save(jchrisUser3).ok);
- CouchDB.replicate(usersDbAlt.name, usersDb.name); // now we should have a conflict
-
var jchrisWithConflict = usersDb.open(jchrisUserDoc._id, {conflicts : true});
T(jchrisWithConflict._conflicts.length == 1);
CouchDB.logout();
diff --git a/test/javascript/tests/view_conflicts.js b/test/javascript/tests/view_conflicts.js
index b1c938c61..3b5a9509e 100644
--- a/test/javascript/tests/view_conflicts.js
+++ b/test/javascript/tests/view_conflicts.js
@@ -24,14 +24,16 @@ couchTests.view_conflicts = function(debug) {
var docA = {_id: "foo", bar: 42};
T(dbA.save(docA).ok);
- CouchDB.replicate(dbA.name, dbB.name);
+ var rep_src = CouchDB.protocol + CouchDB.host + "/" + dbA.name;
+ var rep_tgt = CouchDB.protocol + CouchDB.host + "/" + dbB.name;
+ CouchDB.replicate(rep_src, rep_tgt);
var docB = dbB.open("foo");
docB.bar = 43;
dbB.save(docB);
docA.bar = 41;
dbA.save(docA);
- CouchDB.replicate(dbA.name, dbB.name);
+ CouchDB.replicate(rep_src, rep_tgt);
var doc = dbB.open("foo", {conflicts: true});
T(doc._conflicts.length == 1);
diff --git a/test/javascript/tests/view_include_docs.js b/test/javascript/tests/view_include_docs.js
index cefc2cf90..270defbb5 100644
--- a/test/javascript/tests/view_include_docs.js
+++ b/test/javascript/tests/view_include_docs.js
@@ -169,8 +169,10 @@ couchTests.view_include_docs = function(debug) {
var doc2 = {_id: "bar", value: 2, str: "2"};
TEquals(true, dbA.save(doc2).ok);
-
- TEquals(true, CouchDB.replicate(dbA.name, dbB.name).ok);
+
+ var rep_src = CouchDB.protocol + CouchDB.host + "/" + dbA.name;
+ var rep_tgt = CouchDB.protocol + CouchDB.host + "/" + dbB.name;
+ TEquals(true, CouchDB.replicate(rep_src, rep_tgt).ok);
doc1b = dbB.open("foo", {conflicts: true});
TEquals(true, doc1b._conflicts instanceof Array);