From cacceda9cb4f6f6429d27b6f584622319f32f9e4 Mon Sep 17 00:00:00 2001 From: Paul Mietz Egli Date: Thu, 19 Jun 2014 12:35:39 -0700 Subject: [PATCH] added unit test for setting replication credentials --- mobile/noarch/example/013_replication.js | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/mobile/noarch/example/013_replication.js b/mobile/noarch/example/013_replication.js index efcd48c..bee46e9 100644 --- a/mobile/noarch/example/013_replication.js +++ b/mobile/noarch/example/013_replication.js @@ -165,4 +165,31 @@ module.exports = function() { repl.start(); }); }); + + describe('pull replication with auth credentials', function() { + var conf, repl; + + before(function(done) { + utils.delete_nonsystem_databases(manager); + conf = utils.verify_couchdb_server('replication_config.json', done); + }); + + // currently returning a 400 error due to a request for /elements/_session + it.skip('must replicate with credentials', function(done) { + this.timeout(10000); + var db = manager.getDatabase('repl3'); + repl = db.createPullReplication('http://'+conf.host+':'+conf.port+'/'+conf.dbname); + repl.setCredential({ user: 'scott', pass: 'tiger' }); + repl.addEventListener('status', function(e) { + if (e.status == titouchdb.REPLICATION_MODE_STOPPED) { + should.not.exist(repl.lastError); + db.documentCount.should.eql(118); + repl.isRunning.should.eql(false); + done(); + } + }); + repl.start(); + }); + }); + }; \ No newline at end of file