You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.4 KiB
Markdown
46 lines
1.4 KiB
Markdown
+++
|
|
title = "Test suite: POST /api/quotes/:id — valid auth 200, wrong auth 403, not found 404, partial update, null to clear optional fields"
|
|
priority = 5
|
|
status = "done"
|
|
ticket_type = "task"
|
|
dependencies = ["9b581f", "5d9f5a"]
|
|
+++
|
|
|
|
<context>
|
|
Integration tests live in `tests/` and exercise the API binary against a temporary SQLite database. They run with `cargo test` and must not require a running Cloudflare environment. The test harness spawns the API server on a random port and returns the base URL.
|
|
</context>
|
|
|
|
<goal>
|
|
Write the `POST /api/quotes/:id` test suite in `tests/test_update_quote.rs` (or similar). Test cases:
|
|
1. Valid auth — 200 with updated quote
|
|
2. Wrong auth code — 403 Forbidden
|
|
3. Not found ID — 404 Not Found
|
|
4. Partial update — only the fields in the body are changed, others unchanged
|
|
5. Null to clear optional fields — `{"source": null}` clears the source field
|
|
</goal>
|
|
|
|
<constraints>
|
|
- Use the shared test harness from ticket 9b581f.
|
|
- Create a quote before each test, use its auth_code for valid-auth tests.
|
|
- Verify the update persists by fetching the quote after update.
|
|
</constraints>
|
|
|
|
<skills>
|
|
Use `superpowers:verification-before-completion` before closing.
|
|
</skills>
|
|
|
|
<validation>
|
|
Run in order from the `quotesdb/` directory:
|
|
|
|
```sh
|
|
cargo fmt
|
|
cargo check
|
|
cargo clippy
|
|
cargo test
|
|
```
|
|
</validation>
|
|
|
|
<commit>
|
|
`test(quotesdb): add POST /api/quotes/:id test suite — update with auth`
|
|
</commit>
|