Files
RenewCMS/features/remove_legacy_article_image_alias.qa.md

1.5 KiB

QA procedure: remove_legacy_article_image_alias

Package: test (black-box, httptest, in-memory fakes, no live server).

Setup

  1. Call validator.InitValidator().
  2. Build the article router exactly as NewArticleRouter does after the change (no image handler), wrapped in Verifier, Authenticator, RequireCurrentToken and RequireVerifiedUser, over fake article, image and user repositories. Reuse newMultipartFileRequest and pngBytes from test/media_fixtures_test.go.

HTTP checks

  1. POST /v1/article/1/image with a valid PNG and a valid cookie -> 404, Create never called.
  2. DELETE /v1/article/1/image/10 with a valid cookie -> 404, image 10 still exists.
  3. POST /v1/media/ with a valid PNG -> 201 with id and url (this stays covered by media_library_http_test.go; confirm the case still passes after the deletions).
  4. PATCH /v1/article/1/publish still answers as in verified_account_required_http_test.go.

Cleanup (Go)

  1. Delete test/upload_article_image_http_test.go.
  2. In test/verified_account_required_http_test.go: remove the api/handlers/image import, the imageHandler construction (line 34), the route r.Post("/{id}/image", ...) (line 53) and the "unverified user is refused when attaching an image" case (around line 149).
  3. Run task test and task lint; nothing else may reference PostLegacyArticleImage or handlers/image.

Manual verification

With task dev, curl -i -X POST /v1/article/1/image with a valid cookie answers 404.