test(characters): cover LinkService state machine (Claim/Adopt/Fork)#102
Merged
Merged
Conversation
Closes the audit gap #1 (session 2026-05-17): characters/services.py held all of the link-request business logic with no dedicated, comprehensive test. Adds tests/characters/test_link_service.py exercising: - validate_claim / validate_adopt / validate_fork (all branches) - create_request PENDING vs QUEUED, unknown link type, atomic rollback - accept_request for claim/adopt/fork, queued cancellation, guards - reject_request + QUEUED→PENDING promotion & creator notification (US-15) - cancel_request for PENDING (promotes) and QUEUED (no promote) - get_queue_position ordering - revoke_link draft vs published paths + notification recipient logic - check-then-create concurrency invariant, incl. a threaded row-lock race - build_character_queryset filters (status/system/tag/FTS, remote excluded) Coverage on suddenly/characters/services.py: 100%. Removes the older tests/test_services.py, which tested only LinkService and is fully subsumed by the new dedicated file (no coverage lost). Refs #92 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SkDjRxJt7B8nnEGRT1pbZy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the audit gap #1 (session 2026-05-17): characters/services.py held
all of the link-request business logic with no dedicated, comprehensive test.
Adds tests/characters/test_link_service.py exercising:
Coverage on suddenly/characters/services.py: 100%.
Removes the older tests/test_services.py, which tested only LinkService and
is fully subsumed by the new dedicated file (no coverage lost).
Refs #92
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01SkDjRxJt7B8nnEGRT1pbZy