@@ -157,6 +157,28 @@ def bad_creds_provider(self):
157
157
)
158
158
assert e .match ("invalid username-password" )
159
159
160
+ @pytest .mark .onlynoncluster
161
+ def test_password_and_username_together_with_cred_provider_raise_error (
162
+ self , r , request
163
+ ):
164
+ init_acl_user (r , request , "username" , "password" )
165
+ cred_provider = StaticCredentialProvider (
166
+ username = "username" , password = "password"
167
+ )
168
+ with pytest .raises (DataError ) as e :
169
+ _get_client (
170
+ redis .Redis ,
171
+ request ,
172
+ flushdb = False ,
173
+ username = "username" ,
174
+ password = "password" ,
175
+ credential_provider = cred_provider ,
176
+ )
177
+ assert e .match (
178
+ "'username' and 'password' cannot be passed along with "
179
+ "'credential_provider'."
180
+ )
181
+
160
182
161
183
class TestStaticCredentialProvider :
162
184
def test_static_credential_provider_acl_user_and_pass (self , r , request ):
@@ -186,14 +208,3 @@ def test_static_credential_provider_only_password(self, r, request):
186
208
)
187
209
assert r2 .auth (provider .password ) is True
188
210
assert r2 .ping () is True
189
-
190
- def test_password_and_username_together_with_cred_provider_raise_error (
191
- self , request
192
- ):
193
- creds = StaticCredentialProvider (password = "password" )
194
- with pytest .raises (DataError ) as e :
195
- _get_client (redis .Redis , request , flushdb = False , credential_provider = creds )
196
- assert e .match (
197
- "'username' and 'password' cannot be passed along with "
198
- "'credential_provider'."
199
- )
0 commit comments