Repository navigation
fix: Dialogue Quota Verification - #7932
Merged
Merged
Conversation
shaohuzhang1
commented
Nov 16, 2026
| save_failure_record.assert_called_once() | ||
|
|
||
| def test_available_quota_lets_workflow_run(self): | ||
| """配额未用尽时,前置校验不拦截,正常进入工作流。""" |
Contributor
Author
There was a problem hiding this comment.
The patch is syntactically fine and the new mock/assertion will work. Main review points:
- Weak assertion:
save_failure_record.assert_called_once()only checks that it was called once. It does not verify the failure details. Preferassert_called_once_with(...)or inspectcall_argsto confirm the expected exception/context is passed. - Test name/scope: The test name only mentions “rejected before workflow runs,” but the test now also verifies failure-record persistence. Consider renaming it or splitting the assertion into a separate test.
- Missing negative coverage: In
test_available_quota_lets_workflow_run, consider patchingsave_failure_recordand assertingassert_not_called()so a success path cannot accidentally save a failure record. - Alias naming:
save_failure_recordshadows the patched method name. A clearer alias such assave_failure_record_mockwould improve readability. - Line length: The added line is about 87 characters. If the project enforces 79-character lines, wrap it or use a shorter alias.
- Signature validation: Consider
patch.object(..., autospec=True)if you want the mock to catch signature mismatches. - Persistence not verified: If
save_failure_recordwrites to a DB or external system, this unit test only verifies the call, not that the record is actually persisted. Add an integration test if that behavior matters.
No blocking issue with patch ordering or context-manager usage.
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.
fix: Dialogue Quota Verification