-
Notifications
You must be signed in to change notification settings - Fork 648
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration test coverage for keyring authentication (#3067)
Closes #2464
- Loading branch information
Showing
5 changed files
with
178 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
23 changes: 23 additions & 0 deletions
23
scripts/packages/keyring_test_plugin/keyrings/test_keyring.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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) | ||
credentials = json.loads(os.environ.get("KEYRING_TEST_CREDENTIALS") or {}) | ||
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[build-system] | ||
requires = ["flit_core >=3.2,<4"] | ||
build-backend = "flit_core.buildapi" | ||
|
||
[project] | ||
name = "keyring-test-plugin" | ||
description = "A keyring plugin for testing." | ||
requires-python = ">=3.7" | ||
version = "0.1.0" | ||
keywords = [] | ||
authors = [ | ||
{ name = "Astral Software Inc.", email = "hey@astral.sh" }, | ||
] | ||
dependencies = [ | ||
"keyring" | ||
] | ||
|
||
[tool.flit.module] | ||
name = "keyrings" | ||
|
||
[project.entry-points."keyring.backends"] | ||
AstralTest = "keyrings.test_keyring" |