mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-05 07:25:08 +00:00
feat(dl): add --max-downloads to stop a run after N downloaded titles
This commit is contained in:
@@ -163,12 +163,16 @@ def test_null_takes_the_api_default():
|
||||
assert cast_dl_params(dl.cli, {key: None for key in DEFAULT_DOWNLOAD_PARAMS}) == cast_dl_params(dl.cli, {})
|
||||
|
||||
|
||||
@pytest.mark.parametrize("key", ["downloads", "workers", "channels", "latest_episodes"])
|
||||
@pytest.mark.parametrize("key", ["downloads", "workers", "channels", "latest_episodes", "max_downloads"])
|
||||
def test_a_boolean_is_not_a_number(key):
|
||||
with pytest.raises(click.BadParameter, match=f"Invalid {key}: expected a number"):
|
||||
cast_dl_params(dl.cli, {key: True})
|
||||
|
||||
|
||||
def test_max_downloads_must_be_a_positive_integer():
|
||||
assert refusal({"max_downloads": 0}) == "max_downloads must be a positive integer"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [[1], [None], {"a": 1}])
|
||||
def test_a_non_string_range_is_a_validation_error(value):
|
||||
assert (refusal({"range": value}) or "").startswith("Invalid range")
|
||||
|
||||
Reference in New Issue
Block a user