2.0 KiB
2.0 KiB
QA procedure: remove_legacy_article_image_alias
Superseded in part by roles_permissions_content_scope: the article routes are gated by the content.* permissions of the caller's role (content.create, content.update, content.delete and content.publish; a refusal is 403 "missing_permission" with the header X-Missing-Permission), and content.read decides which drafts show: every draft at all, only the caller's own drafts at own, none otherwise. A draft the caller may not read answers 404 "Article not found", and a role that cannot be resolved is treated as holding no permission.
Package: test (black-box, httptest, in-memory fakes, no live server).
Setup
- Call
validator.InitValidator(). - Build the article router exactly as
NewArticleRouterdoes after the change (no image handler), wrapped inVerifier,Authenticator,RequireCurrentTokenandRequireVerifiedUser, over fake article, image and user repositories. ReusenewMultipartFileRequestandpngBytesfromtest/media_fixtures_test.go.
HTTP checks
POST /v1/article/1/imagewith a valid PNG and a valid cookie -> 404,Createnever called.DELETE /v1/article/1/image/10with a valid cookie -> 404, image 10 still exists.POST /v1/media/with a valid PNG -> 201 withidandurl(this stays covered bymedia_library_http_test.go; confirm the case still passes after the deletions).PATCH /v1/article/1/publishstill answers as inverified_account_required_http_test.go.
Cleanup (Go)
- Delete
test/upload_article_image_http_test.go. - In
test/verified_account_required_http_test.go: remove theapi/handlers/imageimport, theimageHandlerconstruction (line 34), the router.Post("/{id}/image", ...)(line 53) and the "unverified user is refused when attaching an image" case (around line 149). - Run
task testandtask lint; nothing else may referencePostLegacyArticleImageorhandlers/image.
Manual verification
With task dev, curl -i -X POST /v1/article/1/image with a valid cookie answers 404.