chore(api): move webhook tests out of generated code (#3700)
- [x] I understand that this repository is auto-generated and my pull request may not be merged ## Changes being requested Move the handwritten webhook regression suite from the generated resource-test file to `tests/lib/test_webhooks.py`. The new file is byte-for-byte identical to the old file after removing its generated-file header. The generated path returns to the verified Castiron output. All 71 collected cases remain. The existing synthetic signature fixtures, time mocks, secret/header validation, timestamp tolerance, byte payloads, multiple signatures, exceptions, and sync/async client modes are unchanged. No webhook verification code, public API, or generation metadata changes are included. ## Additional context & links Coverage now lives in these exact classes: - [`tests/lib/test_webhooks.py::TestWebhooks`](https://github.com/openai/openai-python/blob/c69d47ae202259ed693a8ae230e97ab988371bfd/tests/lib/test_webhooks.py#L32): 16 methods, 31 collected cases. - [`tests/lib/test_webhooks.py::TestAsyncWebhooks`](https://github.com/openai/openai-python/blob/c69d47ae202259ed693a8ae230e97ab988371bfd/tests/lib/test_webhooks.py#L170): 14 methods, 40 collected cases, including aiohttp. <details> <summary>Exact preserved test methods</summary> Both classes retain: - `test_unwrap_with_secret` - `test_unwrap_without_secret` - `test_unwrap_with_client_secret` - `test_verify_signature_valid` - `test_verify_signature_invalid_secret_format` - `test_verify_signature_invalid` - `test_verify_signature_missing_webhook_signature_header` - `test_verify_signature_missing_webhook_timestamp_header` - `test_verify_signature_missing_webhook_id_header` - `test_verify_signature_payload_bytes` - `test_verify_signature_timestamp_too_old` - `test_verify_signature_timestamp_too_new` - `test_verify_signature_multiple_signatures_one_valid` - `test_verify_signature_multiple_signatures_all_invalid` `TestWebhooks` also retains `test_verify_signature_custom_tolerance` and `test_verify_signature_recent_timestamp_succeeds`. </details> Validation: - Pytest collection matches all 71 original node IDs after replacing only the module path, in both Pydantic modes. - Command: `python -m pytest -q -n 4 tests/api_resources/test_webhooks.py tests/lib/test_webhooks.py` passed 71 tests under Pydantic v2 and 71 under Pydantic v1. - `./scripts/format` and `./scripts/lint` passed, including Ruff, Pyright, mypy, and import checks. Unrelated reporter formatting is excluded. - The public custom-code report verifies 41 -> 40 mixed files, one removed customization, and no other changed customizations. `.castiron.stats.yml` is unchanged. For a byte-level check, both commands return `09e457aee921b3c53c64485fc235724ea4ed5402`: ```sh $ git show 8edd9ae411f9d0a5385447a4697c9f7042868213:tests/api_resources/test_webhooks.py | tail -n +3 | git hash-object --stdin $ git rev-parse c69d47ae202259ed693a8ae230e97ab988371bfd:tests/lib/test_webhooks.py ```
A
Alex Chang committed
04ecb3c21712e1236e7aa2eb9d715d57acb26c35
Parent: 8edd9ae
Committed by GitHub <noreply@github.com>
on 8/20/2026, 10:47:44 PM