def test_virt_who_conf_1(): vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO)) vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF)) vwhod_conf1 = VirtWhoConf(context_wrap(VWHO_D_CONF_HYPER)) vwhod_conf2 = VirtWhoConf(context_wrap(VWHO_D_CONF_ESX)) result = AllVirtWhoConf(vw_sysconf, [vwho_conf, vwhod_conf1, vwhod_conf2]) assert result.background is False assert result.oneshot is True assert result.interval == 1000 assert result.sm_type == 'sat6' assert sorted(result.hypervisor_types) == sorted(['esx', 'hyperv']) expected = [{ 'name': 'esx_1', 'server': '10.72.32.219', 'env': 'Satellite', 'owner': 'Satellite', 'type': 'esx' }, { 'name': 'hyperv_1', 'server': '10.72.32.209', 'env': 'Satellite', 'owner': 'Satellite', 'type': 'hyperv' }] for d in result.hypervisors: assert d in expected
def test_virt_who_conf_2(): vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO_SAT_LEGACY)) vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF)) result = AllVirtWhoConf(vw_sysconf, [vwho_conf]) assert result.background is True assert result.oneshot is False assert result.interval == 3600 assert result.sm_type == 'sat5'
def test_virt_who_conf(): vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF)) assert vwho_conf.has_option('global', 'debug') assert vwho_conf.get('global', 'oneshot') == "False" assert vwho_conf.getboolean('global', 'oneshot') is False assert vwho_conf.get('global', 'interval') == "3600" assert vwho_conf.getint('global', 'interval') == 3600 assert vwho_conf.items('defaults') == { 'owner': 'Satellite', 'env': 'Satellite', 'hypervisor_id': 'ID1'}
def test_virt_who_conf_empty(): with pytest.raises(SkipException): assert VirtWhoConf(context_wrap('')) is None
def test_virt_who_conf_4(): vw_sysconf = VirtWhoSysconfig(context_wrap(SYS_VIRTWHO_CP)) vwho_conf = VirtWhoConf(context_wrap(VWHO_CONF)) result = AllVirtWhoConf(vw_sysconf, [vwho_conf]) assert result.sm_type == 'cp'