-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from pmuller/feature/age_identity-config-and-env
feat: allow configuration of age identities using strings
- Loading branch information
Showing
12 changed files
with
117 additions
and
19 deletions.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
from pathlib import Path | ||
|
||
import pyrage | ||
import pytest | ||
from saltstack_age.identities import read_identity_file | ||
|
||
ROOT = Path(__file__).parent.parent | ||
EXAMPLE_PATH = ROOT / "example" | ||
|
||
|
||
@pytest.fixture() | ||
def example_age_key() -> str: | ||
return str(EXAMPLE_PATH / "config" / "age.key") | ||
def example_age_key_path() -> Path: | ||
return EXAMPLE_PATH / "config" / "age.key" | ||
|
||
|
||
@pytest.fixture() | ||
def example_age_key_path_str(example_age_key_path: Path) -> str: | ||
return str(example_age_key_path) | ||
|
||
|
||
@pytest.fixture() | ||
def example_age_key(example_age_key_path: Path) -> pyrage.x25519.Identity: | ||
return read_identity_file(example_age_key_path) | ||
|
||
|
||
@pytest.fixture() | ||
def example_age_key_str(example_age_key: pyrage.x25519.Identity) -> str: | ||
return str(example_age_key) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from types import ModuleType | ||
from typing import Any, Callable | ||
|
||
import pytest | ||
from saltstack_age.renderers import age | ||
|
||
from tests.unit.renderers import _test_identity | ||
|
||
|
||
@pytest.fixture() | ||
def config_get(example_age_key_path_str: str) -> Callable[[str], str | None]: | ||
def _config_get(key: str) -> str | None: | ||
if key == "age_identity": | ||
return None | ||
assert key == "age_identity_file" | ||
return example_age_key_path_str | ||
|
||
return _config_get | ||
|
||
|
||
@pytest.fixture() | ||
def configure_loader_modules( | ||
config_get: Callable[[str], str | None], | ||
) -> dict[ModuleType, Any]: | ||
return {age: {"__salt__": {"config.get": config_get}}} | ||
|
||
|
||
def test() -> None: | ||
_test_identity.test() |
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