You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f675d8d
Browse filesBrowse the repository at this point in the historyBrowse files
refactor(auth): tests share one way to send requests and read replies (#574)
Part of #544. Builds on #571 and #573 (merged).
Test modules kept their own copies of request code that `crate::tests`
already has, or should have:
- **Requests.** The emails harness had its own `Account` type, request
builder and body reader, copies of `Browser`'s. It now uses `Browser`.
The new `Browser::send_from` sends from a request context of the test's
own, and `Browser::send` calls it.
- **Body readers.** `html`, `json` and `reply` share one private body
reader. The OIDC `Flow::json`/`Flow::text` and passkey `Fixture::json`
are gone, and the clients registry tests read the token endpoint's error
with `json` too.
- **Event history.** The OIDC, passkey, admin and federation tests use a
new `EventRepository::known_history` fixture (added to
`crates/database/src/fixtures.rs` here, with its first callers) instead
of writing out "this account's known events, newest first".
- **Reasons.** `deletion/tests.rs` drops its copy of
`crate::tests::reason`.
### Differences
No test reads any of these:
- The shared readers read up to `MAX_RESPONSE_BYTES` (256 KiB), as
`Browser::call` and the page tests already did. OIDC's `Flow::json` and
`Flow::text` read up to 1 MiB. Passkey's `Fixture::json` and the
registry reader read up to 64 KiB. No response comes near any of these
limits, and none is an assertion. The readers' panic messages change
with them.
- The emails tests send their signed-out requests as
`Browser::signed_out()`, with an empty `Cookie` header instead of none,
as every other signed-out test does. The service reads an empty header
as no cookie.
### Unchanged
- No test was merged or removed. Every file keeps the same test names as
`origin/main`.
- Every assertion checks what it did.
- Outside auth-service's test modules, only
`crates/database/src/fixtures.rs` (for `known_history`) and
`docs/dev/testing.md` (naming the shared readers) change.
### Checks
- `cargo clippy -p auth-service` and `-p sourceorigin-repository`,
`--all-targets`, pass with and without `--all-features`, `-D warnings`.
`just docs` passes.
- `just db test` on the latest `main`: all 499 tests pass, and the query
cache check passes.
- Each commit builds on its own: `known_history` comes before its first
callers.
## Council review
Rounds: 2
| Delegate | Round 1 | Round 2 |
| --- | --- | --- |
| GPT 6.1 Sol | 9/10 | 9/10 |
| Claude Opus 5.5 | 8/10 | 8.5/10 |
| Claude Fable 5.2 | 8.5/10 | 9/10 |
Round 2 found no code defects. Its should-fixes were these descriptions,
and its nits are applied.
> [!NOTE]
> Written by Claude Opus 5.5 in Claude Code and reviewed by GPT 6.1 Sol,
Claude Opus 5.5 and Claude Fable 5.2 (via T3 Code)
0 commit comments