PraisonAIUI uses pytest for all testing. Tests are split into unit and integration categories.
Fast, isolated tests that do not start servers or make network calls.
| Module | File | Count | Description |
|--------|------|-------|-------------|
| Schema Models | test_schema.py | 9 | Validates all Pydantic models: SiteConfig, ContentConfig, TemplateConfig, RouteConfig, Config. Covers defaults, all-fields, and model_validate() |
test_schema.py
SiteConfig
ContentConfig
TemplateConfig
RouteConfig
Config
model_validate()
| Validators | test_validators.py | 4 | Tests validate_config() — broken component refs, missing template refs in routes, missing docs directories |
test_validators.py
validate_config()
| Compiler | test_compiler.py | 16 | Tests the full compilation pipeline: ui-config.json, route-manifest.json, template slot serialization, validation failures, output files, minification, docs-nav.json |
test_compiler.py
ui-config.json
route-manifest.json
docs-nav.json
| Docs Scanner | test_scanner.py | 7 | Tests DocsScanner — empty dirs, frontmatter extraction, index files, nested structures, exclude patterns, number-prefix ordering |
test_scanner.py
DocsScanner
| Serve | test_serve.py | 9 | Tests serve command registration, port handling, SPA fallback, JSON manifest serving, auto-build toggle |
test_serve.py
| Plugins | test_plugins.py | 8 | Tests PluginManager registration, hooks, chaining, BasePlugin defaults, global singleton |
test_plugins.py
PluginManager
BasePlugin
| i18n & a11y | test_i18n_a11y.py | 9 | Tests internationalization and accessibility config models |
test_i18n_a11y.py
Total: 62 unit tests
End-to-end tests that exercise the full CLI pipeline using temporary directories.
| CLI Pipeline | test_cli.py | 11 | Full validate → build → serve pipeline, init command, error handling |
test_cli.py
validate → build → serve
Total: 11 integration tests
These are not automated but are documented here for completeness:
| Test | How to Run | What to Verify |
|------|-----------|----------------|
| Live serve | aiui build && aiui serve | Page loads, sidebar navigates, TOC updates |
aiui build && aiui serve
| SPA routing | Click sidebar items | URL updates without page reload |
| Path traversal | curl --path-as-is 'http://localhost:8000/%2e%2e/etc/passwd' | Returns 403 |
curl --path-as-is 'http://localhost:8000/%2e%2e/etc/passwd'
| CORS | curl -sI -H 'Origin: http://evil.com' http://localhost:8000/ | No access-control headers |
curl -sI -H 'Origin: http://evil.com' http://localhost:8000/
| SSL | aiui serve --ssl-certfile cert.pem --ssl-keyfile key.pem | HTTPS URL shown in output |
aiui serve --ssl-certfile cert.pem --ssl-keyfile key.pem
| All docs serve | Visit each sidebar link | Markdown content renders |
| Favicon | Check browser tab | SVG icon visible |
See the tests/README.md file in the repository for conventions, examples, and templates.
tests/README.md