-
Notifications
You must be signed in to change notification settings - Fork 28
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
ref: Remove references to plan and stripe consts #1130
ref: Remove references to plan and stripe consts #1130
Conversation
list(stripe_plan_dict.values()).index(plan_id) | ||
] | ||
marketing_plan_name = Plan.objects.get(name=plan_name).marketing_name | ||
marketing_plan_name = Plan.objects.get(stripe_id=plan_id).marketing_name |
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 was so much cleaner to me
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.
ya previous way was so annoying
@@ -67,6 +58,7 @@ def mock_all_plans_and_tiers(): | |||
billing_rate=BillingRate.MONTHLY.value, | |||
base_unit_price=PlanPrice.MONTHLY.value, | |||
paid_plan=True, | |||
stripe_id="plan_pro", |
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.
mocked out the stripe_ids for us here for easy referencing
@@ -1326,12 +1328,11 @@ def test_subscription_schedule_released_updates_multiple_owners_with_existing_su | |||
|
|||
self.owner.refresh_from_db() | |||
self.other_owner.refresh_from_db() | |||
assert self.owner.plan == settings.STRIPE_PLAN_VALS[self.new_params["new_plan"]] | |||
|
|||
plan = Plan.objects.get(stripe_id=self.new_params["new_plan"]) |
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.
had to change up the assertions a bit here to match
@@ -1,114 +0,0 @@ | |||
from datetime import datetime |
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.
Removing this command since it was a 1 time script and had some references in there that I didn't want to update
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #1130 +/- ##
=======================================
Coverage 96.02% 96.03%
=======================================
Files 837 837
Lines 19763 19761 -2
=======================================
Hits 18978 18978
+ Misses 785 783 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention: Patch coverage is ✅ All tests successful. No failed tests found.
📢 Thoughts on this report? Let us know! |
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
"price_1Mj1mMGlVGuVgOrkC0ORc6iW": "users-sentryy", | ||
"price_1OCM0gGlVGuVgOrkWDYEBtSL": "users-teamm", | ||
"price_1OCM2cGlVGuVgOrkMWUFjPFz": "users-teamy", | ||
} |
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
extra=dict(owner_id=owner.ownerid), | ||
) | ||
return | ||
|
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.
much better
@@ -202,7 +201,6 @@ def test_inline_orgwide_add_token_permission_no_token_and_user_in_enterprise_clo | |||
self, | |||
): | |||
owner = OwnerFactory(plan=DEFAULT_FREE_PLAN) | |||
assert owner.plan not in ENTERPRISE_CLOUD_USER_PLAN_REPRESENTATIONS |
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.
👀 ??
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 I removed this assertion because the plan is defaulted to the free plan the line before, didn't really make sense to me
@@ -404,6 +413,14 @@ def _modify_subscription_schedule( | |||
current_plan = subscription_item["plan"]["id"] | |||
current_quantity = subscription_item["quantity"] | |||
|
|||
plan = Plan.objects.filter(name=desired_plan["value"]).first() |
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.
Would add some tests to both of these if possible
❌ 1 Tests Failed:
View the top 1 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Purpose/Motivation
This PR is meant to clean up the final few references of the "plan constants" that are no longer needed since migration to the Plan and Tiers tables.
As part of the cleanup, not only are we removing references to those plans but also to the "stripe id": "plan name" maps for dev/stage/prod which have also been ported over to the plan table.
I'm not sure if it would really matter but probably better to keep references to our plans, even if they're hashed values, away from the client as we modify or add more plans in the future. Plus, it's one less thing for us to mangle our way around and I felt like the queries on them for fetching are much easier to parse (much, much easier in some cases).
Tested:
Links to relevant tickets
Closes codecov/engineering-team#3321
Notes to Reviewer
Anything to note to the team? Any tips on how to review, or where to start?
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.