Skip to content

Commit ac958f7

Browse files
committed
fixing test
1 parent f252adf commit ac958f7

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

tests/test_credentials.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def get_random_string(length):
133133

134134
assert r2.ping() is True
135135

136+
@skip_if_redis_enterprise()
137+
@pytest.mark.onlynoncluster
136138
def test_credential_provider_no_password_success(self, r, request):
137139
def creds_provider(self):
138140
return "username", ""
@@ -157,6 +159,27 @@ def bad_creds_provider(self):
157159
)
158160
assert e.match("invalid username-password")
159161

162+
def test_password_and_username_together_with_cred_provider_raise_error(
163+
self, r, request
164+
):
165+
init_acl_user(r, request, "username", "password")
166+
cred_provider = StaticCredentialProvider(
167+
username="username", password="password"
168+
)
169+
with pytest.raises(DataError) as e:
170+
_get_client(
171+
redis.Redis,
172+
request,
173+
flushdb=False,
174+
username="username",
175+
password="password",
176+
credential_provider=cred_provider,
177+
)
178+
assert e.match(
179+
"'username' and 'password' cannot be passed along with "
180+
"'credential_provider'."
181+
)
182+
160183

161184
class TestStaticCredentialProvider:
162185
def test_static_credential_provider_acl_user_and_pass(self, r, request):
@@ -186,14 +209,3 @@ def test_static_credential_provider_only_password(self, r, request):
186209
)
187210
assert r2.auth(provider.password) is True
188211
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)