MCPcopy
hub / github.com/redis/redis-py / r_required_pass_teardown

Function r_required_pass_teardown

tests/test_asyncio/test_credentials.py:73–89  ·  view source on GitHub ↗

A special fixture which removes the provided password from the database after use

(r: redis.Redis)

Source from the content-addressed store, hash-verified

71
72@pytest_asyncio.fixture()
73async def r_required_pass_teardown(r: redis.Redis):
74 """
75 A special fixture which removes the provided password from the database after use
76 """
77 passwords = []
78
79 def factory(username):
80 passwords.append(username)
81 return r
82
83 yield factory
84 for password in passwords:
85 try:
86 await r.auth(password)
87 except (ResponseError, AuthenticationError):
88 await r.auth("default", "")
89 await r.config_set("requirepass", "")
90
91
92class NoPassCredProvider(CredentialProvider):

Calls 2

authMethod · 0.80
config_setMethod · 0.45

Tested by

no test coverage detected