wrolpi/wrolpi/test
Roland 24c5796fc6
db: request-path library functions use the request's connection
Library functions an API request reaches now take the request's Session (first argument) instead of
opening their own session or cursor, so a request needs one SQLite connection.  Raw SQL runs through the
new `wrolpi.db.session_curs(session)`, a cursor on the Session's connection; `RequestDB.curs()` uses it.

- Search: files, videos, archives, flasher, and docs search share the request connection for the total,
  the page of ids, and the page's models (3 connections -> 1).
- Zim search, including tag-filtered search and estimates (2 -> 1).
- Channel detail (`Channel.get_statistics` reads on the Channel's own Session) and the channel list.
- Video detail, edit, description, captions, comments and transcode.  `get_video_for_app` and
  `update_video` no longer commit; their handlers use `request.ctx.db.write()`, so editing a Video and
  reading it back is one transaction.
- Tags (list, overlaps, recent), file statistics and estimates, other estimates, bulk tag preview, the
  download list, retry, kill and the status summary, and docs/videos/archive statistics.

Not converted: file operations that refresh files inside the request (delete, rename, upload, channel
and collection tag/move) commit page by page in code shared with the file worker; the cached zim entry
lookup; config import.

The connection-count tests now assert one connection for every endpoint they cover (no xfails left), and
cover the videos and archive statistics endpoints, which had no API test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 10:10:38 -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 Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
test_api_fixtures.py db: request-path library functions use the request's connection 2026-10-04 10:10:38 -06:00
test_api_utils.py api: run the perpetual loops in one Sanic-managed process (#718) 2026-09-23 07:53:53 -06:00
test_bookmarks.py Bookmarks: a nav menu of user links, stored in bookmarks.yaml (#729) 2026-09-26 13:11:36 -06:00
test_captions.py videos: center YouTube auto-captions at download time 2026-07-16 18:51:36 -06:00
test_cmd.py Single file deno (#478) 2026-06-12 17:07:28 -06:00
test_common.py api: run the perpetual loops in one Sanic-managed process (#718) 2026-09-23 07:53:53 -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 Rebuild Inventory as a config-only system with food catalog and calculators 2026-06-14 17:14:54 -06:00
test_config_partial_import.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
test_contexts.py Reformatting code. 2025-12-06 15:11:37 -07:00
test_cross_config_disaster_recovery.py startup: run database config imports off the worker event loop (#723) 2026-09-24 18:22:52 -06:00
test_dates.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
test_db.py db: one request-scoped database handle per API request (#773) 2026-10-03 15:42:06 -06:00
test_db_bootstrap.py collections: listing answers channel and download queries from covering indexes (#740) 2026-09-27 12:53:40 -06:00
test_downloader.py db: request-path library functions use the request's connection 2026-10-04 10:10:38 -06:00
test_downloads_config.py downloads: daily limit count was lost on restart (#679) 2026-08-29 16:24:52 -06:00
test_events.py Skipping flaky tests on CircleCI. 2026-06-11 19:46:34 -06: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_fts.py Postgres -> SQLite hard cutover: the database moves into the media directory. 2026-07-12 14:09:37 -06:00
test_jobs.py Jobs queue, video Edit dropdown: transcode/remux, edit title & description (#711) 2026-09-16 19:25:23 -06:00
test_perpetual.py api: forked workers die on SIGTERM before Sanic installs their handlers (#743) 2026-10-02 15:49:06 -06:00
test_request_db.py db: request-path library functions use the request's connection 2026-10-04 10:10:38 -06:00
test_root_api.py api: run the perpetual loops in one Sanic-managed process (#718) 2026-09-23 07:53:53 -06:00
test_rss.py Using stubs to simplify tests. 2026-05-07 20:07:46 -06:00
test_speedtest.py Speed Test calculator: ping, download, and upload against the API (#708) 2026-09-13 18:47:18 -06:00
test_switches.py Fix API stalls: non-blocking switch worker, threaded searches, indexed Videos page (#678) 2026-08-29 16:17:53 -06:00
test_tags.py db: request-path library functions use the request's connection 2026-10-04 10:10:38 -06:00
test_upgrade.py api: run the perpetual loops in one Sanic-managed process (#718) 2026-09-23 07:53:53 -06:00