GRI-1856: setup/session integration tests #96

Merged
vivy merged 1 commit from test/GRI-1856-setup-session-integration into dev 2026-11-10 00:19:39 +00:00
Member

Summary

Server-testable setup/session acceptance criteria from plan/tests/mvp-acceptance.md, written against the routes merged in #93 (/api/v1/setup/status, /api/v1/setup, /api/v1/session).

Extends the real-TCP harness from #92 (crates/server/tests/support/mod.rs) with a generic send()/TestResponse helper for arbitrary methods, headers and bodies.

Criterion-to-test mapping

(AC-1-01, first-user setup creating an admin + session via the panel, is E2E and out of scope here.)

  • ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user
  • ac_1_02_setup_with_missing_password_field_is_rejected_and_creates_no_user
  • ac_1_03_setup_is_refused_once_a_user_exists_and_creates_no_second_admin
  • ac_1_04_login_with_correct_credentials_establishes_a_session
  • ac_1_05_login_with_wrong_password_is_rejected_and_establishes_no_session
  • ac_1_06_login_for_unknown_username_is_rejected_the_same_way_as_wrong_password

Each "no user created" assertion is proved by behavior (the next /setup call still succeeding), not by reading the database directly.

Finding: real validation gap, not a test bug

ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user is #[ignore]d with the reason recorded inline. POST /setup currently accepts an empty username and creates the account (201), contrary to AC-1-02. Fail-first output:

$ cargo test -p server --test setup_session_integration ac_1_02_setup_with_empty_username -- --ignored --test-threads=1
thread 'ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user' panicked:
expected 4xx for an empty username, got 201 with body
{"id":"94212a6b-...","email":"setup-test@example.test","name":"Setup Test"}

The sibling case (missing password field) is already correctly rejected. This is a design/implementation gap for the back-end engineer to fix — un-ignoring this test is the regression check once it is.

Test plan

  • cargo test -p server --test setup_session_integration — 5 passed, 1 ignored (the finding above)
  • ./scripts/local-gates.sh — every gate passed (fmt, clippy -D warnings, cargo test, cargo deny, frontend-web)
## Summary Server-testable setup/session acceptance criteria from `plan/tests/mvp-acceptance.md`, written against the routes merged in #93 (`/api/v1/setup/status`, `/api/v1/setup`, `/api/v1/session`). Extends the real-TCP harness from #92 (`crates/server/tests/support/mod.rs`) with a generic `send()`/`TestResponse` helper for arbitrary methods, headers and bodies. ## Criterion-to-test mapping (AC-1-01, first-user setup creating an admin + session via the panel, is E2E and out of scope here.) - `ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user` - `ac_1_02_setup_with_missing_password_field_is_rejected_and_creates_no_user` - `ac_1_03_setup_is_refused_once_a_user_exists_and_creates_no_second_admin` - `ac_1_04_login_with_correct_credentials_establishes_a_session` - `ac_1_05_login_with_wrong_password_is_rejected_and_establishes_no_session` - `ac_1_06_login_for_unknown_username_is_rejected_the_same_way_as_wrong_password` Each "no user created" assertion is proved by behavior (the next `/setup` call still succeeding), not by reading the database directly. ## Finding: real validation gap, not a test bug `ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user` is `#[ignore]`d with the reason recorded inline. `POST /setup` currently accepts an empty username and creates the account (201), contrary to AC-1-02. Fail-first output: ``` $ cargo test -p server --test setup_session_integration ac_1_02_setup_with_empty_username -- --ignored --test-threads=1 thread 'ac_1_02_setup_with_empty_username_is_rejected_and_creates_no_user' panicked: expected 4xx for an empty username, got 201 with body {"id":"94212a6b-...","email":"setup-test@example.test","name":"Setup Test"} ``` The sibling case (missing `password` field) is already correctly rejected. This is a design/implementation gap for the back-end engineer to fix — un-ignoring this test is the regression check once it is. ## Test plan - `cargo test -p server --test setup_session_integration` — 5 passed, 1 ignored (the finding above) - `./scripts/local-gates.sh` — every gate passed (fmt, clippy -D warnings, cargo test, cargo deny, frontend-web)
GRI-1856: setup/session integration tests (AC-1-02..AC-1-06)
Some checks failed
CI / the pre-push hook (pull_request) Successful in 6s
CI / cargo fmt (pull_request) Successful in 9s
CI / cargo deny advisories (pull_request) Failing after 1m24s
CI / cargo deny (pull_request) Successful in 1m26s
CI / repository boundary (pull_request) Successful in 11s
CI / cargo clippy (pull_request) Successful in 9m49s
CI / cargo test (pull_request) Successful in 10m15s
CI / frontend-web (pull_request) Successful in 9m56s
CI / CI (pull_request) Successful in 3s
CI / Notify gate failed (pull_request) Has been skipped
790c4c3a4b
Extends the real-TCP harness in tests/support/mod.rs with a generic
send() helper for arbitrary methods/headers/bodies, and adds
setup_session_integration.rs covering first-user setup validation,
single-admin enforcement, and login success/failure paths.

One case (empty username accepted by POST /setup) is #[ignore]d with
the exact reason: a real validation gap against AC-1-02, not a test bug.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
vivy merged commit cd69e54a2d into dev 2026-11-10 00:19:39 +00:00
vivy deleted branch test/GRI-1856-setup-session-integration 2026-11-10 00:19:40 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage!96
No description provided.