test_authoring_sqlitelisted
Install: claude install-skill jedbjorn/subfloor
# test_authoring_sqlite — SQLite test infra
Rules live in `test_authoring` — read it alongside. This skill = the test
infrastructure PATTERN for SQLite-backed forks.
**Your fork's `tests/conftest.py` is the source of truth** for how the
throwaway DB is built and what fixtures exist — read it before writing a
test. Everything below is the typical shape, not a contract; where your
conftest differs, the conftest wins. A fork may also ship its own superseding
test-authoring skill — if one is granted, prefer it.
## Foundation (typical shape)
`tests/conftest.py` builds a throwaway SQLite DB from the fork's schema
artifact (schema.sql + a migration replay, or a squash), seeds two tenants
(Alice / Bob) + a shared system shell, and drives the real app through
`TestClient` with real auth.
**Key identities (an example roster — confirm against your conftest):**
| Name | Kind | ID |
|---|---|---|
| `USER_ADMIN` | admin user | 1 |
| `USER_A` / Alice | tenant user | 10 |
| `USER_B` / Bob | tenant user | 20 |
| `SHELL_SHARED` | shared system shell | 100 |
| `SHELL_A` / `SHELL_B` | per-tenant shells | 101 / 102 |
| `PROJ_A` / `PROJ_B` | per-tenant projects | 500 / 501 |
| `KEY_A` / `KEY_B` | shell bearer keys | `"ALICEKEY"` / `"BOBKEY"` |
**Throwaway DB setup:**
- `tempfile.NamedTemporaryFile(suffix=".db")` -> path injected via
`os.environ["SHELL_DB_PATH"]` BEFORE importing the app — the auth
middleware calls `db()` directly; a `Depends` override alone misses it.
- The conftest's s