Mocha tests & addition of complete callbacks for login/logout

Includes https://github.com/mikeymckay/couchdb/commit/a324c2c96f0fc339d10a30a5e50ddf9a410e00ca from https://github.com/apache/couchdb/pull/30