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
DELETE /v1/article/1with a valid cookie -> 204,articleRepono longer holds article 1,imageRepo.imagesstill holds 10 and 11 anddeleteCallsis empty.DELETE /v1/article/9999-> 404, body"Article not found\n", image repo untouched.DELETE /v1/article/1without cookie -> 401, article and images still present.- Article fake's
Deletearmed 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.