Skip to content

Commit

Permalink
added unit test for setting replication credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
pegli committed Jun 19, 2014
1 parent 38f8f97 commit cacceda
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions mobile/noarch/example/013_replication.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});

};

0 comments on commit cacceda

Please sign in to comment.