Files
RenewCMS/features/delete_article_keeps_images.qa.md
T

1.6 KiB

QA procedure: delete_article_keeps_images

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). Wire useCases.NewDeleteArticleUseCase(articleRepo) (single argument) with the other article use cases and mount as in the retired delete_article_cascades_images.qa.md: Verifier plus Authenticator, RequireCurrentToken, RequireVerifiedUser, jwt cookie for user id 1. Seed images 10 and 11 in mockImageRepo and the article body with their urls. Call validator.InitValidator() first.

HTTP checks

  1. DELETE /v1/article/1 with a valid cookie -> 204, articleRepo no longer holds article 1, imageRepo.images still holds 10 and 11 and deleteCalls is empty.
  2. DELETE /v1/article/9999 -> 404, body "Article not found\n", image repo untouched.
  3. DELETE /v1/article/1 without cookie -> 401, article and images still present.
  4. Article fake's Delete armed to fail -> 500, body "Failed to delete article\n", image repo untouched.

Manual verification

With a real SQLite file and UPLOAD_DIR, delete an article and confirm the image files and rows remain and still load. No SMTP.