Strengthen players_refactor tests to assert on actual cog method calls
#39
Labels
No Label
ai-changes-requested
ai-failed
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
ai-working
bug
enhancement
feature
in-queue
performance
security
tech-debt
todo
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-discord#39
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
tests/players_refactor/test_team_management.py:500-524— Tests patchapi_calls.db_get, call the mock directly, catch the exception, and pass. The actual cog method is never invoked. Tests pass even if the cog code is deleted.Opened PR #54 to fix this.
Approach: The no-op test body (which called mocks directly and swallowed exceptions without ever touching the cog) was replaced with a test that:
pull_roster_command.callbackfrom the real cog instanceget_context_user,get_team_by_owner, andget_rostersatcogs.players_new.team_management.*get_rostersto raiseException("Connection error")ctx.sendreceived'Could not retrieve rosters from your sheet.'The test skips gracefully if
TeamManagementcan't be imported. It will fail if the method body or exception handler is deleted.