Exemplo n.º 1
0
def test_load():
    # test without defaults
    with codecs.open(CONFIG_FILE, 'r') as handle:
        conf = config.load(handle)

    assert conf['key'] == 'value'
    assert conf['another_key'] == 123
Exemplo n.º 2
0
Arquivo: cli.py Projeto: CGHQ/cghq
def root(context, config, verbose):
    """Central interface to CGHQ."""
    logging.info("running CGHQ v%s", __version__)
    config_dict = config_api.load(config)
    context.obj = config_dict
    logger.debug('setup logging')
    configure_stream(level=LEVELS.get(min(verbose, 3)))
Exemplo n.º 3
0
def test_load_with_defaults():
    defaults = {'key': 'another_value', 'missing': 'default'}
    with codecs.open(CONFIG_FILE, 'r') as handle:
        conf = config.load(handle, defaults=defaults)

    assert conf['key'] == 'value'
    assert conf['another_key'] == 123
    assert conf['missing'] == 'default'