Browse Source
fix another script validation issue (#1774)
* fix another script validation issue
* add test for changing script to str None
* cleanup change_script tests
tags/3.2.0RC1
jcfp
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
3 additions and
3 deletions
-
sabnzbd/nzbqueue.py
-
tests/test_functional_api.py
|
@ -276,7 +276,7 @@ class NzbQueue: |
|
|
|
|
|
|
|
|
def change_script(self, nzo_ids: str, script: str) -> int: |
|
|
def change_script(self, nzo_ids: str, script: str) -> int: |
|
|
result = 0 |
|
|
result = 0 |
|
|
if is_valid_script(script): |
|
|
if (script is None) or is_valid_script(script): |
|
|
for nzo_id in [item.strip() for item in nzo_ids.split(",")]: |
|
|
for nzo_id in [item.strip() for item in nzo_ids.split(",")]: |
|
|
if nzo_id in self.__nzo_table: |
|
|
if nzo_id in self.__nzo_table: |
|
|
self.__nzo_table[nzo_id].script = script |
|
|
self.__nzo_table[nzo_id].script = script |
|
|
|
@ -715,8 +715,8 @@ class TestQueueApi(ApiTestFunctions): |
|
|
False, |
|
|
False, |
|
|
marks=pytest.mark.skipif(sys.platform.startswith("win"), reason="Not for Windows"), |
|
|
marks=pytest.mark.skipif(sys.platform.startswith("win"), reason="Not for Windows"), |
|
|
), |
|
|
), |
|
|
(None, True, False), |
|
|
("None", False, True), |
|
|
("", True, False), |
|
|
("", False, False), |
|
|
], |
|
|
], |
|
|
) |
|
|
) |
|
|
def test_api_queue_change_job_script(self, script_filename, create_scriptfile, should_work): |
|
|
def test_api_queue_change_job_script(self, script_filename, create_scriptfile, should_work): |
|
|