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
Example #2
0
File: cli.py Project: 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)))
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'