@@ -545,22 +545,38 @@ def test_connect_from_url_unix(self):
545
545
)
546
546
547
547
@skip_if_redis_enterprise ()
548
- def test_connect_no_auth_supplied_when_required (self , r ):
548
+ def test_connect_no_auth_configured (self , r ):
549
549
"""
550
- AuthenticationError should be raised when the server requires a
551
- password but one isn't supplied.
550
+ AuthenticationError should be raised when the server is not configured with auth
551
+ but credentials are supplied by the user .
552
552
"""
553
+ # Redis < 6
553
554
with pytest .raises (redis .AuthenticationError ):
554
555
r .execute_command (
555
556
"DEBUG" , "ERROR" , "ERR Client sent AUTH, but no password is set"
556
557
)
557
558
559
+ # Redis >= 6
560
+ with pytest .raises (redis .AuthenticationError ):
561
+ r .execute_command (
562
+ "DEBUG" , "ERROR" , "ERR AUTH <password> called without any password "
563
+ "configured for the default user. Are you sure "
564
+ "your configuration is correct?"
565
+ )
566
+
558
567
@skip_if_redis_enterprise ()
559
- def test_connect_invalid_password_supplied (self , r ):
560
- "AuthenticationError should be raised when sending the wrong password"
568
+ def test_connect_invalid_auth_credentials_supplied (self , r ):
569
+ """
570
+ AuthenticationError should be raised when sending invalid username/password
571
+ """
572
+ # Redis < 6
561
573
with pytest .raises (redis .AuthenticationError ):
562
574
r .execute_command ("DEBUG" , "ERROR" , "ERR invalid password" )
563
575
576
+ # Redis >= 6
577
+ with pytest .raises (redis .AuthenticationError ):
578
+ r .execute_command ("DEBUG" , "ERROR" , "WRONGPASS" )
579
+
564
580
565
581
@pytest .mark .onlynoncluster
566
582
class TestMultiConnectionClient :
0 commit comments