Exemplo n.º 1
0
def test_get_config_without_anything(parse_config):
    config = Config()
    ret = config.get_config('worker')
    assert ret is not None
    arg_list = parse_config.call_args_list
    assert len(arg_list) == 2
    args, kwargs = arg_list[0]
    assert kwargs == {
        'section': 'worker',
        'config_path': config.get_default_config_path()
    }
    args, kwargs = arg_list[1]
    assert kwargs == {
        'section': 'worker',
        'config_path': config.get_default_config_path()
    }
Exemplo n.º 2
0
def test_get_config_without_anything_but_os_env(parse_config):
    os.environ['CODEPACK_CONFIG_PATH'] = 'config/test.ini'
    try:
        config = Config()
        ret = config.get_config('worker')
        assert ret is not None
        arg_list = parse_config.call_args_list
        assert len(arg_list) == 2
        args, kwargs = arg_list[0]
        assert kwargs == {
            'section': 'worker',
            'config_path': 'config/test.ini'
        }
        args, kwargs = arg_list[1]
        assert kwargs == {
            'section': 'worker',
            'config_path': config.get_default_config_path()
        }
    finally:
        os.environ.pop('CODEPACK_CONFIG_PATH')