2024-04-17 12:23:26 -05:00
|
|
|
import json
|
|
|
|
|
import os
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
from keyring import backend
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class KeyringTest(backend.KeyringBackend):
|
|
|
|
|
priority = 9
|
|
|
|
|
|
|
|
|
|
def get_password(self, service, username):
|
|
|
|
|
print(f"Request for {username}@{service}", file=sys.stderr)
|
2024-11-27 20:54:49 +01:00
|
|
|
credentials = json.loads(os.environ.get("KEYRING_TEST_CREDENTIALS", "{}"))
|
2024-04-17 12:23:26 -05:00
|
|
|
return credentials.get(service, {}).get(username)
|
|
|
|
|
|
|
|
|
|
def set_password(self, service, username, password):
|
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
|
|
def delete_password(self, service, username):
|
|
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
|
|
def get_credential(self, service, username):
|
|
|
|
|
raise NotImplementedError()
|