EMAIL-WP-0005-T03: add test-user addressing and reset helper
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 2s

Adds the tests/harness helper package: address(), available(), reset(),
users(), smtp_provider() and mailbox_config().

Tests address mailboxes as harness.address("<test name>"), which slugs the name
under the RFC 2606 reserved harness.email-connect.test domain, so distinct test
names cannot collide and a stray send cannot leave the host. No provisioning
call is needed -- the auth-disabled harness creates the mailbox on first login.

reset() drops every user and message via GreenMail's service reset; the next
login recreates the mailbox empty. It is documented to run at test start so a
crashed test cannot leak state forward, and it is global, so resetting tests
cannot run in parallel against one harness.

Suite: 64 passed with the harness up, 61 passed + 3 skipped with it down.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-08-14 01:46:09 +02:00
parent 89fd13ac2d
commit 442a574cf9
5 changed files with 328 additions and 2 deletions

View file

@ -211,7 +211,7 @@ Done 2026-08-14:
```task
id: EMAIL-WP-0005-T03
status: todo
status: done
priority: high
state_hub_task_id: "c761d26d-a8b0-4b66-ba18-8f22c6d59440"
```
@ -242,6 +242,24 @@ Test credentials are deliberately non-secret and belong in the repo. Per
provider material; the harness must not touch them.
```
Done 2026-08-14:
* `tests/harness/__init__.py` helper package: `address()`, `available()`,
`reset()`, `users()`, `smtp_provider()`, `mailbox_config()`.
* Convention is `harness.address("<test name>")` → slug@`harness.email-connect.test`.
`.test` is RFC 2606 reserved, so a stray send cannot leave the host. No
provisioning call is needed — T02's auth-disabled setup creates the mailbox on
first login, so distinct names are automatically isolated.
* Reset contract: `harness.reset()` (GreenMail `POST /api/service/reset`) drops
all users and mail; the next login recreates the mailbox empty. Documented to
run at test *start*, so a crashed test cannot leak state forward. It is
global, so resetting tests cannot run in parallel against one harness.
Verified: send → 1 message and a live user → reset → no users, mailbox empty.
* Credentials stay non-secret placeholders in the repo; OpenBao is untouched.
* Tests: `tests/test_harness_users.py`, 12 cases. Slug and config cases run
offline; the three harness-dependent cases skip when it is down. Suite: 64
passed with the harness up, 61 passed + 3 skipped with it down.
## T04 - End-to-end send-and-scan integration tests
```task