Пример #1
0
def test_ps_eo():
    p = ps.PsEo(context_wrap(PS_EO_NORMAL, strip=False))
    assert p is not None
    assert len(p.pid_info) == 23
    assert '15663' in p.pid_info
    assert p.pid_info['2416'] == {
        'PID': '2416',
        'PPID': '1',
        'COMMAND': 'auditd',
        'COMMAND_NAME': 'auditd',
        'ARGS': ''
    }
    assert p.pid_info['18379'] == {
        'PID': '18379',
        'PPID': '18347',
        'COMMAND': 'ps',
        'COMMAND_NAME': 'ps',
        'ARGS': ''
    }
    assert p.children('18347') == [{
        'PID': '18379',
        'PPID': '18347',
        'COMMAND': 'ps',
        'COMMAND_NAME': 'ps',
        'ARGS': ''
    }]
    assert len(p.children('2')) == 6
Пример #2
0
def test_doc_examples():
    env = {
        'ps': ps.PsAuxww(context_wrap(PsAuxww_TEST_DOC)),
        'ps_auxww': ps.PsAuxww(context_wrap(PsAuxww_TEST_DOC)),
        'ps_ef': ps.PsEf(context_wrap(PsEf_TEST_DOC)),
        'ps_eo': ps.PsEo(context_wrap(PsEo_TEST_DOC, strip=False)),
        'ps_alxwww': ps.PsAlxwww(context_wrap(PsAlxwww_TEST_DOC)),
        'ps_eo_cmd': ps.PsEoCmd(context_wrap(PsEoCmd_TEST_DOC))
    }
    failed, total = doctest.testmod(ps, globs=env)
    assert failed == 0
Пример #3
0
def test_ps_eo_cmd_stripped():
    p = ps.PsEo(context_wrap(PS_EO_CMD_NORMAL, strip=True))
    assert p is not None
    assert len(p.running_pids()) == 7
Пример #4
0
def test_ps_eo_stripped():
    p = ps.PsEo(context_wrap(PS_EO_NORMAL, strip=True))
    assert p is not None
    assert len(p.pid_info) == 23