1
0
secret_loader/test/test_init.py

18 lines
495 B
Python
Raw Normal View History

2024-06-12 21:02:31 +00:00
import secret_loader
2024-06-12 21:36:32 +00:00
2024-07-16 19:39:58 +00:00
def test_hardcoded():
2024-07-22 22:45:59 +00:00
loader = secret_loader.SecretLoader(ENV_KEY_PREFIX='TEST', KEY='VALUE')
assert loader.load('ENV_KEY_PREFIX') == 'TEST'
2024-06-12 21:36:21 +00:00
assert loader.load('KEY') == 'VALUE'
2024-07-07 21:36:58 +00:00
2024-07-22 22:45:59 +00:00
2024-09-04 17:37:06 +00:00
def test_lookup_secrets_dir():
loader = secret_loader.SecretLoader(SECRETS_DIRECTORY='test/example-secrets')
assert loader.load('MY_SECRET') == 'HELLO SECRET'
2024-07-07 21:36:58 +00:00
def test_lookup_unknown():
loader = secret_loader.SecretLoader()
2024-07-07 21:36:58 +00:00
assert loader.load('UNKNOWN') is None