diff --git a/src/aria2p/api.py b/src/aria2p/api.py index 39c67f0..2438378 100644 --- a/src/aria2p/api.py +++ b/src/aria2p/api.py @@ -409,13 +409,11 @@ def pause_all(self, force=False): Returns: bool: Success or failure of the operation to pause all downloads. """ - # if force: - # pause_func = self.client.force_pause_all - # else: - # pause_func = self.client.pause_all - # return pause_func() == "OK" - - return all(self.pause([d for d in self.get_downloads() if d.status in ("active", "waiting")], force=force)) + if force: + pause_func = self.client.force_pause_all + else: + pause_func = self.client.pause_all + return pause_func() == "OK" def resume(self, downloads): """ @@ -449,7 +447,7 @@ def resume_all(self): Returns: bool: Success or failure of the operation to resume all downloads. """ - return all(self.resume(self.get_downloads())) + return self.client.unpause_all() == "OK" def autopurge(self): """ diff --git a/tests/test_cli.py b/tests/test_cli.py index 81aa3df..e4e28a9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -169,9 +169,9 @@ def test_resume_all_subcommand(): assert cli.subcommand_resume(server.api, do_all=True) == 0 -def test_resume_all_subcommand_fails(): +def test_resume_all_subcommand_doesnt_fail_with_already_active_downloads(): with Aria2Server(port=7519, session=SESSIONS_DIR / "dl-2-aria2.txt") as server: - assert cli.subcommand_resume(server.api, do_all=True) == 1 + assert cli.subcommand_resume(server.api, do_all=True) == 0 def test_remove_subcommand():