wrolpi/wrolpi/test
Roland 9cc5c15e32 fix: coerce sleep_requests and numeric settings from string form values
`sleep_requests` (and other numeric inheritable video download settings)
could arrive as strings ('' or '0.75') from the frontend NumberInputForm
and DownloadRequest bodies. These were persisted into Download.settings
(JSONB) and later triggered:

    if effective['sleep_requests'] > 0:
    TypeError: '>' not supported between instances of 'str' and 'int'

in VideoDownloader.execute_download (and similar sites).

Root cause: DownloadSettings.__post_init__ only filtered None/[] and did
no type coercion, even though the dataclass declared Optional[float]/int.

Changes (minimal targeted fix):
- Add _coerce_optional_number helper and apply it to all numeric fields
  in DownloadSettings.__post_init__ (the existing sanitization boundary).
- Centralize legacy string coercion for persisted data in the single
  read chokepoint: get_effective_video_settings.
- Simplify VideoDownloaderConfig.sleep_requests getter.
- Frontend: use parseFloat for type=number inputs + null defaults for
  sleep_requests (prevents '' from ever being submitted).
- Add focused regression test for string coercion path.
- Revert unrelated change to string field filtering behavior.

No NaN/Inf speculation, no duplicated try/float guards at every call site,
no behavior change for non-numeric settings.
2026-05-31 13:02:31 -06:00
..
fixtures/configs Add Docs module for searching and organizing PDFs and EPUBs 2026-03-20 14:17:06 -06:00
__init__.py A new start 2021-11-01 16:43:09 -06:00
common.py Creating a new Collection model for use in organizing FileGroups. 2025-12-06 15:11:37 -07:00
test_captions.py Adding links next to video captions to allow scrubbing of video by the captions, adding filter to make finding quick. 2026-03-21 16:50:27 -06:00
test_cmd.py Displaying download progress (speed, eta) for file and video downloads. 2026-03-12 19:31:35 -06:00
test_common.py Key changes: 2026-04-04 13:48:19 -06:00
test_config_api.py Changing archive special directory default to include domain tag. 2025-12-25 15:42:35 -07:00
test_config_backup_import.py Add Docs module for searching and organizing PDFs and EPUBs 2026-03-20 14:17:06 -06:00
test_contexts.py Reformatting code. 2025-12-06 15:11:37 -07:00
test_cross_config_disaster_recovery.py Moving config import out of main so that it can be properly tested. Adding tests for different scenerios when config imports fail. 2026-02-14 17:21:39 -07:00
test_dates.py Testing that downloads have absolute destinations. Handling 'undefined', 'null', etc, dates. 2025-03-21 17:14:53 -06:00
test_db.py Removing optional_session, passing session down from request middleware. Moving session param to the front of functions. 2025-12-11 16:03:18 -07:00
test_downloader.py fix: coerce sleep_requests and numeric settings from string form values 2026-05-31 13:02:31 -06:00
test_downloads_config.py Add Docs module for searching and organizing PDFs and EPUBs 2026-03-20 14:17:06 -06:00
test_events.py Moving config import out of main so that it can be properly tested. Adding tests for different scenerios when config imports fail. 2026-02-14 17:21:39 -07:00
test_extensions.py Creating browser extension to facilitate starting downloads. Chrome/Brave and Firefox supported. 2026-05-03 11:48:50 -06:00
test_flags.py Displaying warning when no drive is mounted. 2026-05-14 16:16:18 -06:00
test_root_api.py Updating tests for Retry button retrying failed downloads. 2026-04-05 13:14:57 -06:00
test_rss.py Using stubs to simplify tests. 2026-05-07 20:07:46 -06:00
test_switches.py FileWorker: Async queue-based file synchronization system 2026-01-23 15:29:15 -07:00
test_tags.py Add Docs module for searching and organizing PDFs and EPUBs 2026-03-20 14:17:06 -06:00
test_upgrade.py Reformatting code. 2025-12-06 15:11:37 -07:00