-
Notifications
You must be signed in to change notification settings - Fork 429
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: Organisation reverts to free plan #3096
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 #3096 +/- ##
==========================================
+ Coverage 96.11% 96.12% +0.01%
==========================================
Files 1059 1059
Lines 32037 32136 +99
==========================================
+ Hits 30792 30891 +99
Misses 1245 1245 ☔ 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.
This looks really good now! Just some minor comments
assert subscription.notes == notes | ||
|
||
|
||
def test_finish_subscription_cancellation(db: None) -> None: |
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 we should add an assert statement here somewhere to make sure the task was scheduled correctly?
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.
Yeah that's a good call. Added.
@@ -38,6 +38,17 @@ def send_org_over_limit_alert(organisation_id): | |||
) | |||
|
|||
|
|||
@register_task_handler() | |||
def send_org_subscription_cancelled_alert( |
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 do understand this is a tiny method, but can we add a test for this as well?
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.
Haha, sure. Added one.
|
||
# When | ||
send_org_subscription_cancelled_alert( | ||
organisation_name="Nike", |
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.
Nike here makes me feel a bit uncomfortable for some reason… can we rename it to test
or something
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.
Agree with this.
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 forget we're developing Open Source and Nike could ruffle feathers. In general, I like realistic named tests, but for this one it's the right call to change it something neutral.
# Subscription has been immediately transformed to free. | ||
assert subscription.cancellation_date is None |
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.
Feels like there should be more asserts here?
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.
This test was originally targeted at chargebee and other tests enforced the other checks, but I've added more asserts because there is no downside.
|
||
# When | ||
send_org_subscription_cancelled_alert( | ||
organisation_name="Nike", |
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.
Agree with this.
Thanks for submitting a PR! Please check the boxes below:
pre-commit
to check lintingdocs/
if required so people know about the feature!Changes
When a subscription cancels we lead to a mismatch in what the user expects, since they're no longer on the former subscription. What this change does is wipe out most of the subscription data and reverts it to what is at present for an empty free subscription.
How did you test this code?
With a test through a task.