praisonaiui.testing gives plugin packages an official, isolated test harness so you can verify manifest entries, pages, strict CSP script hashes, static ESM assets, WebSocket tickets, and ASGI lifespan hooks in a few lines — without copying internal server fixtures.
praisonaiui.testing
lifespan
| Check | Default | What it verifies |
|---|---|---|
| Plugin status | always | manifest["plugins"] includes your plugin with status == "ok" |
manifest["plugins"]
status == "ok"
| Declared pages | always | Every PageSpec from plugin.pages() appears in manifest["pages"] and GET /<page_id> returns 200 text/html |
PageSpec
plugin.pages()
manifest["pages"]
GET /<page_id>
200 text/html
| Strict CSP (check_csp) | True | Content-Security-Policy contains 'sha256-…' hashes and never 'unsafe-inline' in script-src |
check_csp
True
Content-Security-Policy
'sha256-…'
'unsafe-inline'
script-src
| Static modules (check_static) | True | Every /_plugins/<name>/<module> URL returns 200 |
check_static
/_plugins/<name>/<module>
200
| WS ticket (check_ws_ticket) | True | POST /api/auth/ws-ticket mints a non-empty single-use ticket |
check_ws_ticket
POST /api/auth/ws-ticket
| Shell isolation (check_shell_isolation) | True | Unmounted agent routes (/sessions) return 404 |
check_shell_isolation
/sessions
404
If you construct create_app() or create_shell_app() directly in a test, wrap it in isolated_aiui_state() so global page registries, themes, configs, PluginRegistry, and AIUI_DATA_DIR are automatically snapshotted and restored — even if the test raises an exception:
create_app()
create_shell_app()
isolated_aiui_state()
PluginRegistry
AIUI_DATA_DIR