Add regression tests: escrow refunds, permission classes, hub subfield, user serializer edge cases#3206
Draft
cursor[bot] wants to merge 2 commits intomainfrom
Draft
Add regression tests: escrow refunds, permission classes, hub subfield, user serializer edge cases#3206cursor[bot] wants to merge 2 commits intomainfrom
cursor[bot] wants to merge 2 commits intomainfrom
Conversation
…ield, user serializer, and feed task edge cases - Escrow.refund(): 10 tests covering zero amount, exceeding balance, status transitions, sequential refunds, and balance record creation - HasAdminPermission, HasEditingPermission, HasOrgEditingPermission, HasAccessPermission: 18 unit tests covering admin/editor/viewer/outsider/ anonymous access paths and missing unified_document - Hub.get_from_subfield: edge cases for journal namespace exclusion, subfield_id fallback, and duplicate hub behavior - DynamicUserSerializer.get_author_profile: test for missing author_profile - create_feed_entry: test for deleted item behavior Co-authored-by: Kobe Attias <kobeattias@gmail.com>
Co-authored-by: Kobe Attias <kobeattias@gmail.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3206 +/- ##
==========================================
+ Coverage 78.53% 78.57% +0.03%
==========================================
Files 612 612
Lines 34284 34284
==========================================
+ Hits 26926 26937 +11
+ Misses 7358 7347 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.




Risky behavior now covered
perm=Falseorg-path behavior.{}instead of crashing (high-traffic serializer, ~640 Sentry events/day from this path).Test files added/updated
src/reputation/tests/test_escrow.py(new)src/researchhub_access_group/tests/test_document_permissions.py(new)src/hub/tests/test_models.pysrc/user/tests/test_serializers.pysrc/feed/tests/test_tasks.pyWhy these tests materially reduce regression risk
Escrow.refund()handles real money flows. The 10 new tests catch regressions in amount validation, balance updates, and status transitions that could cause fund loss or double-refunds.