Esempio n. 1
0
def test_not_called_when_core_collection_disabled(map_rm_conf_to_components):
    '''
    Verify that the function is not called from get_rm_conf when core_collect=False
    '''
    upload_conf = InsightsUploadConf(Mock(core_collect=False))
    upload_conf.get_rm_conf()
    map_rm_conf_to_components.assert_not_called()
def test_called_when_core_collection_enabled(map_rm_conf_to_components):
    '''
    Verify that the function is called from get_rm_conf when core_collect=True
    '''
    upload_conf = InsightsUploadConf(Mock(core_collect=True))
    upload_conf.get_rm_conf()
    map_rm_conf_to_components.assert_called_once_with({'test': 'test'})
Esempio n. 3
0
def test_raw_config_parser():
    '''
        Ensure that get_rm_conf and json.loads (used to load uploader.json) return the same filename
    '''
    raw_filename = '/etc/yum/pluginconf.d/()*\\\\w+\\\\.conf'
    uploader_snip = json.loads('{"pattern": [], "symbolic_name": "pluginconf_d", "file": "' + raw_filename + '"}')
    with open(conf_remove_file, 'w') as rm_conf:
        rm_conf.write('[remove]\nfiles=' + raw_filename)
    coll = InsightsUploadConf(InsightsConfig(remove_file=conf_remove_file))
    items = coll.get_rm_conf()
    assert items['files'][0] == uploader_snip['file']
def insights_upload_conf(*args, **kwargs):
    """
    Instantiates InsightsUploadConf with a config created with given arguments.
    """
    config = InsightsConfig(*args, **kwargs)
    return InsightsUploadConf(config)