A special fixture which removes the provided password from the database after use
(r: redis.Redis)
| 71 | |
| 72 | @pytest_asyncio.fixture() |
| 73 | async 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 | |
| 92 | class NoPassCredProvider(CredentialProvider): |
no test coverage detected