mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
add ability to read values from environment variables
It makes sense to read some values from environment. In particular this feature is useful in case of running application in containers in ci/cd See #108 for more details
This commit is contained in:
15
tests/ahriman/core/configuration/test_shell_interpolator.py
Normal file
15
tests/ahriman/core/configuration/test_shell_interpolator.py
Normal file
@ -0,0 +1,15 @@
|
||||
import os
|
||||
|
||||
from ahriman.core.configuration.shell_interpolator import ShellInterpolator
|
||||
|
||||
|
||||
def test_before_get() -> None:
|
||||
"""
|
||||
must correctly extract environment variables
|
||||
"""
|
||||
interpolator = ShellInterpolator()
|
||||
|
||||
assert interpolator.before_get({}, "", "", "value", {}) == "value"
|
||||
assert interpolator.before_get({}, "", "", "$value", {}) == "$value"
|
||||
assert interpolator.before_get({}, "", "", "$HOME", {}) == os.environ["HOME"]
|
||||
assert interpolator.before_get({}, "", "", "$$HOME", {}) == "$HOME"
|
Reference in New Issue
Block a user