@@ -545,22 +545,38 @@ def test_connect_from_url_unix(self):
545545 )
546546
547547 @skip_if_redis_enterprise ()
548- def test_connect_no_auth_supplied_when_required (self , r ):
548+ def test_connect_no_auth_configured (self , r ):
549549 """
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 .
552552 """
553+ # Redis < 6
553554 with pytest .raises (redis .AuthenticationError ):
554555 r .execute_command (
555556 "DEBUG" , "ERROR" , "ERR Client sent AUTH, but no password is set"
556557 )
557558
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+
558567 @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
561573 with pytest .raises (redis .AuthenticationError ):
562574 r .execute_command ("DEBUG" , "ERROR" , "ERR invalid password" )
563575
576+ # Redis >= 6
577+ with pytest .raises (redis .AuthenticationError ):
578+ r .execute_command ("DEBUG" , "ERROR" , "WRONGPASS" )
579+
564580
565581@pytest .mark .onlynoncluster
566582class TestMultiConnectionClient :
0 commit comments