@@ -34,19 +34,32 @@ describe("client authentication", function () {
34
34
} ) ;
35
35
} ) ;
36
36
37
- it ( "raises error when auth is bad" , function ( done ) {
37
+ it ( "emits error when auth is bad without callback " , function ( done ) {
38
38
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
39
39
40
40
client = redis . createClient . apply ( redis . createClient , args ) ;
41
41
42
- client . once ( 'error' , function ( error ) {
43
- assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( error ) ) ;
42
+ client . once ( 'error' , function ( err ) {
43
+ assert . strictEqual ( err . command_used , 'AUTH' ) ;
44
+ assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( err . message ) ) ;
44
45
return done ( ) ;
45
46
} ) ;
46
47
47
48
client . auth ( auth + 'bad' ) ;
48
49
} ) ;
49
50
51
+ it ( "returns an error when auth is bad with a callback" , function ( done ) {
52
+ if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
53
+
54
+ client = redis . createClient . apply ( redis . createClient , args ) ;
55
+
56
+ client . auth ( auth + 'bad' , function ( err , res ) {
57
+ assert . strictEqual ( err . command_used , 'AUTH' ) ;
58
+ assert . ok ( / E R R i n v a l i d p a s s w o r d / . test ( err . message ) ) ;
59
+ done ( ) ;
60
+ } ) ;
61
+ } ) ;
62
+
50
63
if ( ip === 'IPv4' ) {
51
64
it ( 'allows auth to be provided as part of redis url' , function ( done ) {
52
65
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
@@ -70,6 +83,19 @@ describe("client authentication", function () {
70
83
} ) ;
71
84
} ) ;
72
85
86
+ it ( 'allows auth and no_ready_check to be provided as config option for client' , function ( done ) {
87
+ if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
88
+
89
+ var args = config . configureClient ( parser , ip , {
90
+ auth_pass : auth ,
91
+ no_ready_check : true
92
+ } ) ;
93
+ client = redis . createClient . apply ( redis . createClient , args ) ;
94
+ client . on ( "ready" , function ( ) {
95
+ done ( ) ;
96
+ } ) ;
97
+ } ) ;
98
+
73
99
it ( 'allows auth to be provided post-hoc with auth method' , function ( done ) {
74
100
if ( helper . redisProcess ( ) . spawnFailed ( ) ) this . skip ( ) ;
75
101
0 commit comments