fix unit test msg

This commit is contained in:
Jesse Bannon 2023-07-25 14:30:24 -07:00
parent 2c858ffadb
commit e46cf6aa6b
2 changed files with 7 additions and 4 deletions

View file

@ -185,7 +185,7 @@ class MultiUrlValidator(OptionsValidator):
Partially validate a collection
"""
if isinstance(value, dict):
value["urls"] = value.get("urls", [{"url": "placeholder"}])
value["url"] = value.get("url", "sadfasdf")
_ = cls(name, value)
def __init__(self, name, value):
@ -197,9 +197,11 @@ class MultiUrlValidator(OptionsValidator):
# Pop old required field in case it's still there
value_copy.pop("download_strategy", None)
if "urls" in value:
self._urls = UrlListValidator(name=name, value=value["urls"])
if "urls" in value_copy:
self._urls = UrlListValidator(name=name, value=value_copy["urls"])
else:
# Validate using a single URL validator first
_ = UrlValidator(name=name, value=value_copy)
self._urls = UrlListValidator(name=name, value=[value_copy])
else:
# Should error here. TODO: Add simplifications download here (string, list)

View file

@ -98,7 +98,8 @@ class TestConfigFilePartiallyValidatesPresets:
preset_dict={"download": {"download_strategy": "multi_url", "bad_key": "nope"}},
expected_error_message="Validation error in partial_preset.download: "
"'partial_preset.download' contains the field 'bad_key' which is not allowed. "
"Allowed fields: urls",
"Allowed fields: download_reverse, playlist_thumbnails, source_thumbnails, url, "
"variables",
)
@pytest.mark.parametrize(