Commit 752bcc7
wildleo91
test(ring-1-day-2-chunk-1): dispatch integrity + simple POST happy paths
Ring 1 Day 2 chunk 1 — 26 new tests, all passing. Total suite 720
(was 694).
tests/integration/test_dispatch_integrity.py (new) — 16 tests:
Read-only contract tests for the GET_ACTIONS and POST_ACTIONS
dispatch tables. No fixture overhead. Catches an entire class of
silent wiring bugs:
- Tables exist + non-empty (2)
- Entry shape: (roles, method_name) where roles is None or a
collection of strings, method_name is a string (2)
- Method resolution: every method_name resolves to a callable on
the handler instance (2)
- Naming convention: every method follows _action_<name> (2)
- No duplicate names across or within tables (3)
- RBAC tier hard-list — superadmin/admin/edit actions pinned to
the right tier; weakening fails the test (3)
- Public actions allow-list — every action with roles=None must
be on a hardcoded allow-list with documented rationale (2).
Catches the regression where a destructive action silently
loses its role tier.
Discovery during writing: roles are Set[str], not tuple. Test
adjusted; this is the kind of contract clarification that test-
writing surfaces.
tests/integration/test_post_happy_paths.py (new) — 10 tests:
Each test issues a real POST against the test container and
asserts the FULL response shape, not just top-level keys. Uses
container_state fixture for state-mutating tests.
Tier 1 (no preconditions) — 7 tests:
- mark_notifications_read — success flag
- save_col_widths — success flag + round-trip via GET
- log_event — csv_exported / csv_imported / audit_exported
- set_trash_retention — config file persisted
Tier 2 (preconditions) — 3 tests:
- create_csv — full shape (success, csv_file echo, message)
- create_rule — full shape (success, detection_rule echo, message)
- save_csv (small edit) — including the pending_approvals deep
contract that pins all 8 build-641 fields. Same projection
drift as build-641 in this endpoint would fail this test.
API contract discoveries:
- create_csv and create_rule both take detection_rule (not
rule_name) — pinned in test fixtures so it's self-documenting
- save_csv requires detection_rule + headers + rows + expected_*;
test now follows the proper sequence: GET mapping → resolve
rule → GET csv_content → POST save_csv
Day 2 continues with more happy paths + error paths.1 parent bb87c32 commit 752bcc7
3 files changed
Lines changed: 895 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
382 | 382 | | |
383 | 383 | | |
384 | 384 | | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
0 commit comments