Skip to content

Commit 975c75d

Browse files
committed
NODE-757 added test showing kay:kay worked
1 parent 6ec5042 commit 975c75d

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

lib/url_parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ module.exports = function(url, options) {
224224
replSetServersOptions.poolSize = parseInt(value, 10);
225225
break;
226226
case 'appname':
227-
object.appname = decodeURI(value);
227+
object.appname = decodeURIComponent(value);
228228
case 'autoReconnect':
229229
case 'auto_reconnect':
230230
serverOptions.auto_reconnect = (value == 'true');

test/functional/authentication_tests.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,44 @@ exports['should fail due to illegal authentication mechanism'] = {
4343
}
4444
}
4545

46+
/**
47+
* @ignore
48+
*/
49+
exports['should correctly authenticate with kay.kay'] = {
50+
metadata: { requires: { topology: ['auth'] } },
51+
52+
// The actual test we wish to run
53+
test: function(configuration, test) {
54+
var Db = configuration.require.Db
55+
, MongoClient = configuration.require.MongoClient
56+
, Server = configuration.require.Server;
57+
58+
// restart server
59+
configuration.manager.restart(true).then(function() {
60+
var db1 = new Db('test', new Server(configuration.host, configuration.port, {auto_reconnect: true}), {w:1});
61+
db1.open(function(err, db) {
62+
test.equal(null, err);
63+
64+
db.admin().addUser('kay:kay', 'abc123', function(err, result) {
65+
test.equal(null, err);
66+
67+
// Login the user
68+
db.admin().authenticate("kay:kay", "abc123", function(err, result) {
69+
test.equal(null, err);
70+
71+
MongoClient.connect('mongodb://kay%3Akay:abc123@localhost:27017/admin', function(err, db) {
72+
// restart server
73+
configuration.manager.restart(true).then(function() {
74+
test.done();
75+
});
76+
});
77+
});
78+
});
79+
});
80+
});
81+
}
82+
}
83+
4684
/**
4785
* Retrieve the current replicaset status if the server is running as part of a replicaset using a Promise.
4886
*

0 commit comments

Comments
 (0)