How to use the aria2p.cli.main function in aria2p

To help you get started, we’ve selected a few aria2p examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pawamoy / aria2p / tests / test_cli.py View on Github external
def test_errors_and_print_message(capsys):
    with Aria2Server(port=7502) as server:
        assert cli.main(["-p", str(server.port), "call", "tellstatus", "-P", "invalid gid"]) > 0
        assert capsys.readouterr().err == "Invalid GID invalid gid\n"
github pawamoy / aria2p / tests / test_cli.py View on Github external
def test_parser_no_error(mocked_function):
    with Aria2Server(port=7550) as server:
        cli.main(["-p", str(server.port), "purge", "-a"])
        assert mocked_function.called
github pawamoy / aria2p / tests / test_cli.py View on Github external
def test_parser_error_when_gids_and_all_option(capsys):
    with pytest.raises(SystemExit) as e:
        cli.main(["pause", "-a", "2089b05ecca3d829"])
        assert e.value.code == 2
    lines = err_lines(capsys)
    assert lines[0].startswith("usage: aria2p pause")
    assert lines[1].endswith("-a/--all: not allowed with arguments gids")
github pawamoy / aria2p / tests / test_cli.py View on Github external
def test_main_no_command_defaults_to_top(mocked_function):
    with Aria2Server(port=7500) as server:
        cli.main(["-p", str(server.port)])
        assert mocked_function.called
github pawamoy / aria2p / tests / test_cli.py View on Github external
def test_main_show_subcommand(capsys):
    with Aria2Server(port=7501) as server:
        cli.main(["-p", str(server.port), "show"])
        first_line = first_out_line(capsys)
        for word in ("GID", "STATUS", "PROGRESS", "DOWN_SPEED", "UP_SPEED", "ETA", "NAME"):
            assert word in first_line
github pawamoy / aria2p / src / aria2p / __main__.py View on Github external
"""
Entry-point module, in case you use `python -m aria2p`.

Why does this file exist, and why __main__? For more info, read:

- https://www.python.org/dev/peps/pep-0338/
- https://docs.python.org/2/using/cmdline.html#cmdoption-m
- https://docs.python.org/3/using/cmdline.html#cmdoption-m
"""

import sys

from aria2p.cli import main

if __name__ == "__main__":
    sys.exit(main(sys.argv[1:]))