Пример #1
0
def test_call_subcommand(capsys):
    with Aria2Server(port=7504) as server:
        assert cli.subcommand_call(server.api, "wrongMethod", []) == 1
        assert (
            capsys.readouterr().err ==
            "aria2p: call: Unknown method wrongMethod.\n"
            "  Run 'aria2p call listmethods' to list the available methods.\n")
Пример #2
0
def test_call_subcommand_with_no_params():
    with Aria2Server(port=7506) as server:
        assert cli.subcommand_call(server.api, "listmethods", None) == 0
Пример #3
0
def test_call_subcommand_with_json_params():
    with Aria2Server(port=7505,
                     session=SESSIONS_DIR /
                     "dl-aria2-1.34.0-paused.txt") as server:
        assert cli.subcommand_call(server.api, "tellstatus",
                                   '["2089b05ecca3d829"]') == 0
Пример #4
0
def test_call_subcommand_with_no_params(server):
    assert cli.subcommand_call(server.api, "listmethods", None) == 0
Пример #5
0
def test_call_subcommand_with_json_params(tmp_path, port):
    with Aria2Server(tmp_path, port, session="1-dl-paused.txt") as server:
        assert cli.subcommand_call(server.api, "tellstatus",
                                   '["0000000000000001"]') == 0