summaryrefslogtreecommitdiff
path: root/tests/accel-cmd/test_real_commands.py
blob: 1758b4e5d59647c63a03a1509bfc1b8e628bda82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pytest
from common import process


@pytest.fixture()
def accel_pppd_config():
    return """
    [modules]

    [log]
    log-debug=/dev/stdout
    level=5

    [cli]
    tcp=127.0.0.1:2001
    """


# test accel-cmd command with started accel-pppd
def test_accel_cmd_commands(accel_pppd_instance, accel_cmd):

    # test that accel-pppd started successfully
    assert accel_pppd_instance

    (exit_sh_stat, out_sh_stat, err_sh_stat) = process.run([accel_cmd, "show stat"])

    # test that 'show stat' has no errors and contains 'uptime'
    assert (
        exit_sh_stat == 0
        and len(out_sh_stat) > 0
        and err_sh_stat == ""
        and "uptime" in out_sh_stat
    )

    (exit_sh_ses, out_sh_ses, err_sh_ses) = process.run(
        [accel_cmd, "show sessions sid,uptime"]
    )
    # test that 'show sessions' has no errors and contains 'sid'
    assert (
        exit_sh_ses == 0
        and len(out_sh_ses) > 0
        and err_sh_ses == ""
        and "sid" in out_sh_ses
    )

    (exit_help, out_help, err_help) = process.run([accel_cmd, "help"])
    # test that 'help' has no errors and contains 'show stat'
    assert (
        exit_help == 0
        and len(out_help) > 0
        and err_help == ""
        and "show stat" in out_help
    )