Skip to content

Commit 3a41474

Browse files
committed
fixing test
1 parent 8c3844b commit 3a41474

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

tests/test_credentials.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,28 @@ def bad_creds_provider(self):
157157
)
158158
assert e.match("invalid username-password")
159159

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+
160182

161183
class TestStaticCredentialProvider:
162184
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):
186208
)
187209
assert r2.auth(provider.password) is True
188210
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

Comments
 (0)