Skip to content
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

Merged
merged 8 commits into from
Nov 27, 2023
Merged

Conversation

zachaysan
Copy link
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have run pre-commit to check linting
  • I have filled in the "Changes" section below?
  • I have filled in the "How did you test this code" section below?
  • I have used a Conventional Commit title for this Pull Request

Changes

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.

Copy link

vercel bot commented Nov 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 6:44pm
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 6:44pm
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2023 6:44pm

Copy link
Contributor

github-actions bot commented Nov 23, 2023

Uffizzi Preview deployment-41386 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (762e2dc) 95.73% compared to head (1cc1de6) 95.74%.

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@matthewelwell matthewelwell left a 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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 :)

api/organisations/views.py Show resolved Hide resolved
Copy link
Contributor

@matthewelwell matthewelwell left a 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()
Copy link
Contributor

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.

Copy link
Contributor Author

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants