# QA procedure: upload_article_image Package: `test` (black-box, extending `article_test.go` / `image_test.go`). ## Setup shared by every case 1. Call `validator.InitValidator()` once. 2. Wire `image.NewHandler(createImageUseCase, getArticleUseCase)` (no update or delete use cases) and mount only `POST /{id}/image` in the article group, behind `Verifier`, `Authenticator`, `RequireCurrentToken`, `RequireVerifiedUser`. 3. Use real image bytes generated in the test, as in `media_library.qa.md` step 8, and multipart bodies with an explicit part `Content-Type`. ## HTTP checks 4. Valid PNG on article 1 -> 201 `{id, location}` matching the created image, and `articleRepo.articles[1]` has an unchanged body. 5. Unknown article 9999 -> 404 `"Article not found\n"`, `Create` never called. 6. Rejected files: `application/pdf` -> 415, PNG padded to 10485761 bytes -> 413, text bytes as `image/png` -> 400; `Create` never called. 7. No cookie -> 401, `Create` never called. 8. `DELETE /v1/article/1/image/10` on this router -> 405, image 10 still exists. ## Cleanup Delete `test/remove_article_image_http_test.go` and update `test/upload_article_image_http_test.go` to the cases above. ## Manual verification With a real instance, `POST /v1/article/{id}/image` writes a file to `UPLOAD_DIR` and a row visible in `GET /v1/media/`, and no article association is written.