Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_pause_all_subcommand_doesnt_fail_with_already_paused_downloads():
with Aria2Server(port=7514, session=SESSIONS_DIR / "2-dl-in-queue.txt") as server:
assert cli.subcommand_pause(server.api, do_all=True) == 0
def test_pause_subcommand_already_paused(capsys):
with Aria2Server(port=7511, session=SESSIONS_DIR / "2-dl-in-queue.txt") as server:
assert cli.subcommand_pause(server.api, ["2089b05ecca3d829", "cca3d8292089b05e"]) == 1
assert (
capsys.readouterr().err
== "GID#2089b05ecca3d829 cannot be paused now\nGID#cca3d8292089b05e cannot be paused now\n"
)
def test_pause_subcommand_one_paused(capsys):
with Aria2Server(port=7512, session=SESSIONS_DIR / "one-active-one-paused.txt") as server:
assert cli.subcommand_pause(server.api, ["2089b05ecca3d829", "cca3d8292089b05e"]) == 1
assert capsys.readouterr().err == "GID#cca3d8292089b05e cannot be paused now\n"
def test_pause_all_subcommand():
with Aria2Server(port=7513) as server:
assert cli.subcommand_pause(server.api, do_all=True) == 0