python-dependency-injector/examples/providers/configuration/configuration_ini.py

14 lines
456 B
Python
Raw Normal View History

2020-06-26 00:12:16 +03:00
"""`Configuration` provider values loading example."""
from dependency_injector import providers
config = providers.Configuration()
config.from_ini('examples/providers/configuration/config.ini')
assert config() == {'aws': {'access_key_id': 'KEY', 'secret_access_key': 'SECRET'}}
assert config.aws() == {'access_key_id': 'KEY', 'secret_access_key': 'SECRET'}
assert config.aws.access_key_id() == 'KEY'
assert config.aws.secret_access_key() == 'SECRET'