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_purge_all_subcommand():
with Aria2Server(port=7526) as server:
assert cli.subcommand_purge(server.api, do_all=True) == 0
def test_purge_subcommand():
with Aria2Server(port=7524, session=SESSIONS_DIR / "very-small-remote-file.txt") as server:
while not server.api.get_download("2089b05ecca3d829").is_complete:
time.sleep(0.2)
assert cli.subcommand_purge(server.api, ["2089b05ecca3d829"]) == 0
def test_purge_subcommand_one_failure(capsys):
with Aria2Server(port=7525, session=SESSIONS_DIR / "small-file-and-paused-file.txt") as server:
while not server.api.get_download("2089b05ecca3d829").is_complete:
time.sleep(0.2)
assert cli.subcommand_purge(server.api, ["2089b05ecca3d829", "208a3d8299b05ecc"]) == 1
lines = err_lines(capsys)
assert lines[1] == "Could not remove download result of GID#208a3d8299b05ecc"