def test_env_names_with_prefixes(env_name, apply_prefix, env_prefix, key): spec = YapconfSpec( { 'bg_host': { 'type': 'str', 'env_name': env_name, 'apply_env_prefix': apply_prefix, } }, env_prefix=env_prefix) config = spec.load_config(('ENVIRONMENT', {key: 'host_value'})) assert config.bg_host == 'host_value'
def test_load_specification_from_file(file_type, file_data, overrides, expected_value): open_path = builtins_path + '.open' with patch(open_path, mock_open(read_data=file_data)): spec = YapconfSpec('/path/to/specification', file_type=file_type) assert spec.load_config(overrides) == expected_value