Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_password_write_read(self):
"""Test that passwords written to a keychain can be read back."""
with keyper.TemporaryKeychain() as keychain:
for index, password in enumerate(KeyperPasswordTests.SAMPLE_PASSWORDS):
keyper.set_password(password, account=f"account_{index}", service=f"service_{index}", keychain=keychain)
returned_password = keyper.get_password(account=f"account_{index}", service=f"service_{index}", keychain=keychain)
self.assertEqual(password, returned_password)