-
Notifications
You must be signed in to change notification settings - Fork 104
test(playstation): Assert entire payload #5292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(playstation): Assert entire payload #5292
Conversation
| assert event["attachments"] == ( | ||
| { | ||
| "id": mock.ANY, | ||
| "name": "playstation.prosperodmp", | ||
| "rate_limited": False, | ||
| "content_type": "application/octet-stream", | ||
| "attachment_type": "playstation.prosperodump", | ||
| "size": 209385, | ||
| "chunks": 1, | ||
| }, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: An assertion in test_playstation_attachment_no_feature_flag compares a list event["attachments"] with a tuple literal, causing a type mismatch and test failure.
Severity: HIGH | Confidence: 1.00
🔍 Detailed Analysis
The test_playstation_attachment_no_feature_flag test fails due to a type mismatch in an assertion. The event["attachments"] variable, which is a list, is compared against a tuple literal ({...},) using the equality operator. Python's == operator returns False when comparing a list and a tuple, even if their elements are identical, causing the assertion to fail.
💡 Suggested Fix
Modify the assertion at tests/integration/test_playstation.py:488~498 to compare event["attachments"] with a list literal [{...}] instead of a tuple ({...},), or use the attachments() helper.
🤖 Prompt for AI Agent
Fix this bug. In tests/integration/test_playstation.py at lines 488-498: The
`test_playstation_attachment_no_feature_flag` test fails due to a type mismatch in an
assertion. The `event["attachments"]` variable, which is a list, is compared against a
tuple literal `({...},)` using the equality operator. Python's `==` operator returns
`False` when comparing a list and a tuple, even if their elements are identical, causing
the assertion to fail.
Did we get this right? 👍 / 👎 to inform future reviews.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Something that came up recently when talking with David is that we want to assert entire payloads instead of just key-value pairs. This PR converts some tests that are specifically egregious over to asserting on the entire payload (and extracts the payload into a helper function to avoid duplication).