You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-04 15:02:09 +03:00
Fix auth emitting the error even though a callback is present
Fix auth manipulating the returned error And this is also removing some dead code
This commit is contained in:
@@ -34,7 +34,7 @@ describe("client authentication", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it("raises error when auth is bad", function (done) {
|
||||
it("emits error when auth is bad without callback", function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
|
||||
client = redis.createClient.apply(redis.createClient, args);
|
||||
@@ -48,6 +48,18 @@ describe("client authentication", function () {
|
||||
client.auth(auth + 'bad');
|
||||
});
|
||||
|
||||
it("returns an error when auth is bad with a callback", function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
|
||||
client = redis.createClient.apply(redis.createClient, args);
|
||||
|
||||
client.auth(auth + 'bad', function (err, res) {
|
||||
assert.strictEqual(err.command_used, 'AUTH');
|
||||
assert.ok(/ERR invalid password/.test(err.message));
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
if (ip === 'IPv4') {
|
||||
it('allows auth to be provided as part of redis url', function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
@@ -71,6 +83,19 @@ describe("client authentication", function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('allows auth and no_ready_check to be provided as config option for client', function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
|
||||
var args = config.configureClient(parser, ip, {
|
||||
auth_pass: auth,
|
||||
no_ready_check: true
|
||||
});
|
||||
client = redis.createClient.apply(redis.createClient, args);
|
||||
client.on("ready", function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('allows auth to be provided post-hoc with auth method', function (done) {
|
||||
if (helper.redisProcess().spawnFailed()) this.skip();
|
||||
|
||||
|
Reference in New Issue
Block a user