Example #1
0
def test_sysconfig_doc():
    env = {
            'chronyd_syscfg': ChronydSysconfig(context_wrap(CHRONYDSYSCONFIG)),
            'ntpd_syscfg': NtpdSysconfig(context_wrap(NTPDSYSCONFIG)),
            'docker_syscfg': DockerSysconfig(context_wrap(DOCKERSYSCONFIG)),
            'docker_syscfg_storage': DockerSysconfigStorage(context_wrap(DOCKER_CONFIG_STORAGE)),
            'httpd_syscfg': HttpdSysconfig(context_wrap(HTTPDSYSCONFIG)),
            'irqb_syscfg': IrqbalanceSysconfig(context_wrap(IRQBALANCESYSCONFIG)),
            'vwho_syscfg': VirtWhoSysconfig(context_wrap(VIRTWHOSYSCONFIG)),
            'mongod_syscfg': MongodSysconfig(context_wrap(MONGODSYSCONFIG)),
            'memcached_syscfg': MemcachedSysconfig(context_wrap(MEMCACHEDSYSCONFIG)),
            'libvirt_guests_syscfg': LibvirtGuestsSysconfig(context_wrap(LIBVIRTGUESTSSYSCONFIG)),
            'prelink_syscfg': PrelinkSysconfig(context_wrap(PRELINKSYSCONFIG)),
            'u2d_syscfg': Up2DateSysconfig(context_wrap(UP2DATESYSCONFIG)),
            'netcs_syscfg': NetconsoleSysconfig(context_wrap(NETCONSOLESYSCONFIG)),
            'sshd_syscfg': SshdSysconfig(context_wrap(SSHDSYSCONFIG)),
            'pps_syscfg': PuppetserverSysconfig(context_wrap(PUPPETSERVERCONFIG)),
            'ft_syscfg': ForemanTasksSysconfig(context_wrap(FOREMANTASKSYSCONFG)),
            'dss_syscfg': DockerStorageSetupSysconfig(context_wrap(DOCKERSTORAGESETUPSYSCONFG)),
            'dirsrv_syscfg': DirsrvSysconfig(context_wrap(DIRSRVSYSCONFG)),
            'cs_syscfg': CorosyncSysconfig(context_wrap(COROSYNCSYSCONFIG)),
            'conn_info': IfCFGStaticRoute(context_wrap(STATIC_ROUTE_1, CONTEXT_PATH_DEVICE_1)),
            'net_syscfg': NetworkSysconfig(context_wrap(NETWORK_SYSCONFIG))
          }
    failed, total = doctest.testmod(sysconfig, globs=env)
    assert failed == 0
def test_static_route_connection_2():
    context = context_wrap(STATIC_ROUTE_1, CONTEXT_PATH_DEVICE_2)
    r = IfCFGStaticRoute(context)
    assert r.static_route_name == 'test-net-11'
    assert r.data == {
        'ADDRESS0': '10.65.223.0',
        'NETMASK0': '255.255.254.0',
        'GATEWAY0': '10.65.223.1'
    }
def test_missing_index():
    with pytest.raises(IndexError):
        context = context_wrap(STATIC_ROUTE_2, CONTEXT_PATH_DEVICE_3)
        r = IfCFGStaticRoute(context)
        assert r.static_route_name == 'eth0'