refac: article reads, story delete, no leaks, stored SEO status, rate limit, cleanup (%site%, article repo split, old lang repos, one default per site rule to domain)
This commit is contained in:
1 parent
9d284e65a9
commit
7c15206170
85 files changed
+1788
-593
No files matched your search
@@ -5,12 +5,14 @@ Backend only. Go tests in test/, black-box. No design states.
|
||||
## Automated, no server (task test)
|
||||
1. Use cases over fakes (article, site, language, localization, role grants) and a fake Transactor: the capabilities and translations mapping, the publish rule, deleting the last version and MoveStory. Table-driven over every Examples table; assert the sentinels with errors.Is. MoveStory runs the permission check, the language check, the slug check and all writes inside one Transactor.Run, and a failing write rolls back all fake rows.
|
||||
2. HTTP via the article NewHandler and the new story handler, a chi router mirroring api/router.go (/article and /story mounts, authtoken group), validator.InitValidator(), httptest and jwt cookies for owner, writer1, reader and none. Assert exact bodies and the headers X-Existing-Article-Id (absent where not allowed), X-Current-Revision, X-Conflicting-Articles and X-Missing-Languages. Hidden versions appear in no body, header or count.
|
||||
3. Anonymous reads: the key set is the slice 1 set plus revision, capabilities, translations and source.
|
||||
3. Anonymous reads: the key set is the slice 1 set plus revision, capabilities, translations and source. Signed-in reads add missing_langs, excluded_from_public, source_unavailable and partial_view (TestArticleEditorialContextHTTP; TestArticleCreatedByHttp compares the two shapes).
|
||||
3b. Whole-article delete: TestStoryDeleteHTTP covers every scenario of the "Deleting a whole article" rule over the story world (fake transactor with rollback, DeleteStory failure injected through the fail switch).
|
||||
4. Activity: a fake recorder receives params.lang on publish, unpublish, edit, delete and per-version move events.
|
||||
5. Regression: the article_publishing and article_title_rules tests pass with the updated pair text.
|
||||
|
||||
## Automated, SQLite file (task test)
|
||||
6. Deleting the last version removes the story row, deleting one keeps it. Re-creating fr after deleting fr works. The site_languages in-use count still includes a deleted fr version (slice 2 TestLanguageInUseCountsSoftDeletedVersions stays green).
|
||||
6b. DeleteStory: TestArticleSEOIndex* "Deleting an article removes every version and the article row" (live versions 0, story row gone, slugs free, a second call is not found), on SQLite and on the real databases.
|
||||
7. Move: all site_id values change together. A unique (site_id, lang, slug) violation at the destination rolls back every row. An injected write failure on the third row leaves all rows unchanged.
|
||||
8. PATCH site_id counts readable versions only: with one readable version in a multi-version story it runs the full story move (every version, hidden ones too, moves in one transaction; language and slug refusals roll back and name readable versions only), which needs content.update on every version (403 missing_permission otherwise); with two readable versions it is 409 story_move_required.
|
||||
|
||||
|
||||
Reference in new issue
Block a user