-
Notifications
You must be signed in to change notification settings - Fork 415
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
feat: Rebuild chargebee caches #3028
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Uffizzi Preview |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3028 +/- ##
=======================================
Coverage 95.73% 95.74%
=======================================
Files 1044 1045 +1
Lines 30866 30889 +23
=======================================
+ Hits 29551 29574 +23
Misses 1315 1315 ☔ View full report in Codecov by Sentry. |
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.
Looks good on the whole. I've left a few comments but only one that I think should definitely change.
) | ||
# Then | ||
assert response.status_code == 200 | ||
task.assert_called_once() |
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.
I'd rather be more specific here - wouldn't it be simpler (and more specific) to just mock the task function in the webhook_handlers module and then call like mocked_task.delay.assert_called_once_with()
?
I think the current implementation also relies on settings.TASK_RUN_METHOD == "SYNCHRONOUSLY"
whereas the above approach wouldn't?
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.
Sure I can switch it to that. I like to call tasks but if you don't think there is value here I can mock the task.
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.
Ok this has been updated :)
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.
Approved with one minor comment. Feel free to merge before / after implementing the suggested change :)
) | ||
# Then | ||
assert response.status_code == 200 | ||
task.delay.assert_called_once() |
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.
I think I'd prefer to see this as task.delay.assert_called_once_with()
to prove that we're calling it with no arguments, but it's not super important.
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.
Sure that's no problem :)
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingChanges
Added another chargebee webhook handler function to filter events that may lead to us needing to update the chargebee cache.
How did you test this code?
Played around with the code by hand to make sure I understood the chargebee API plus some work on their test interface UI to get the webhook information then a single test based off of typical event. It's not complicated code so I'm not worried.