feat: editor write path
This commit is contained in:
1 parent
d9158025d4
commit
a0b3c58c52
88 files changed
+5738
-263
No files matched your search
@@ -1,4 +1,5 @@
|
||||
Feature: The article title rule is the same in the request and the domain
|
||||
Superseded in part by article_edit_revision: titles are editable.
|
||||
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.
|
||||
|
||||
As the maintainer of RenewCMS
|
||||
@@ -26,9 +27,7 @@ Feature: The article title rule is the same in the request and the domain
|
||||
500 with body "Failed to create article"
|
||||
And POST /v1/article/ sits behind the jwtauth Verifier and Authenticator group and
|
||||
requires a valid jwt cookie
|
||||
And UpdateArticleUseCase exposes only UpdateBody, AddImage and UpdateIsOnline; no
|
||||
route or use case updates an article's title after creation, so this feature only
|
||||
concerns article creation
|
||||
And PATCH /v1/article/{id} accepts `title` with the same 3-200 rune rule, rejected as 400 with apperr.ArticleTitleErrorMessage (see features/article_edit_revision.feature)
|
||||
|
||||
Scenario Outline: CreateArticle now measures title length in runes, not bytes
|
||||
Given an empty article repository fake
|
||||
@@ -76,6 +75,34 @@ Feature: The article title rule is the same in the request and the domain
|
||||
And the response body is the text apperr.ArticleTitleErrorMessage
|
||||
And the response body is not "Failed to create article"
|
||||
|
||||
Scenario Outline: PATCH /v1/article/{id} enforces the same 3-200 rune boundary
|
||||
Given a valid jwt cookie for a user holding content.update
|
||||
And the article repository contains an article with id 1
|
||||
When the client sends PATCH /v1/article/1 with that cookie and a title of <length> ASCII characters
|
||||
Then the response status is <status>
|
||||
And <storage_effect>
|
||||
|
||||
Examples:
|
||||
| length | status | storage_effect |
|
||||
| 2 | 400 | the title is unchanged |
|
||||
| 3 | 200 | the title is stored |
|
||||
| 200 | 200 | the title is stored |
|
||||
| 201 | 400 | the title is unchanged |
|
||||
|
||||
Scenario: A domain title rejection on update is a 400, not a 500
|
||||
Given a valid jwt cookie for a user holding content.update
|
||||
And the article repository fake is configured so its next Update call returns article.ErrInvalidTitle
|
||||
When the client sends PATCH /v1/article/1 with that cookie and title "Valid Title"
|
||||
Then the response status is 400
|
||||
And the response body is the text apperr.ArticleTitleErrorMessage
|
||||
|
||||
Scenario: Editing the title does not change the slug
|
||||
Given a valid jwt cookie for a user holding content.update
|
||||
And the article with id 1 has slug "backyard-renovation-update"
|
||||
When the client sends PATCH /v1/article/1 with that cookie and title "A brand new title"
|
||||
Then the response status is 200
|
||||
And the slug is still "backyard-renovation-update"
|
||||
|
||||
Scenario: A non-title repository failure during creation still answers 500
|
||||
Given a valid jwt cookie for a user with id 1
|
||||
And the article repository fake is configured to fail on its next Create call with
|
||||
|
||||
Reference in new issue
Block a user