Example #1
0
def test_scale_char():
    p = PPPing(args=['foo.bar'], duration=3, no_host=True)

    rtt = [5, 15, 25, 35, 45, 55, 65, 75]
    expected = ['▁', '▂', '▃', '▄', '▅', '▆', '▇', '█']

    for i, e in zip(rtt, expected):
        assert p.scale_char(i) == e
Example #2
0
def test_only_ipv6():
    p = PPPing(args=test_host, duration=3, only_ipv6=True)
    assert p.info.find(GLOBAL + ' (None') > 0
    assert p._p_cmd == PING6_CMD
    assert p._p_opt == ' '.join([PING_OPT])
    p.run(scr)
Example #3
0
def test_only_ipv4():
    p = PPPing(args=test_host, duration=3, only_ipv4=True)
    assert p.info.find(', None)') > 0
    assert p._p_cmd == PING_CMD or PING4_CMD
    assert p._p_opt == ' '.join([PING_OPT])
    p.run(scr)
Example #4
0
def test_connected_network():
    p = PPPing(args=test_host, duration=3, no_host=True, closed=False)
    assert p._n_headers == 3
    assert p.info.find(GLOBAL) > 0
    p.run(scr)
Example #5
0
def test_closed_network():
    p = PPPing(args=test_host, duration=3, no_host=True, closed=True)
    assert p.info.find('None, None') > 0
    p.run(scr)
Example #6
0
def test_open_config():
    with pytest.raises(FileNotFoundError):
        PPPing(args=[], duration=3, config='nothing.conf', no_host=False)
Example #7
0
def test_failed_host():
    p = PPPing(args=['foo.bar'], duration=3, no_host=True)
    p.run(scr)
Example #8
0
def test_config_no_host_false():
    p = PPPing(args=[], duration=3, config='ppping.conf', no_host=False)
    p.run(scr)
Example #9
0
def test_no_host_false():
    p = PPPing(args=test_host, duration=3, no_host=False)
    p.run(scr)
Example #10
0
def test_no_host():
    p = PPPing(args=test_host, duration=3, no_host=True)
    p.run(scr)