-
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
API: Migrate to Plan / Tier Tables #1099
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #1099 +/- ##
========================================
Coverage 96.09% 96.10%
========================================
Files 832 835 +3
Lines 19507 19628 +121
========================================
+ Hits 18746 18863 +117
- Misses 761 765 +4
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! |
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
✅ All tests successful. No failed tests were found. 📣 Thoughts on this report? Let Codecov know! | Powered by Codecov |
@@ -131,11 +130,6 @@ def validate_value(self, value: str) -> str: | |||
plan["value"] for plan in plan_service.available_plans(current_owner) | |||
] | |||
if value not in plan_values: | |||
if value in SENTRY_PAID_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.
Removed this because it would now just be an extra DB call for a log lol
bef1fa7
to
3a5b3af
Compare
This PR includes changes to |
@@ -219,7 +222,7 @@ def get_plan(self, phase: Dict[str, Any]) -> str: | |||
plan_name = list(stripe_plan_dict.keys())[ |
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 can probably be further cleaned up by doing a get on the stripe_id 🤔
@@ -637,7 +637,10 @@ def validate_upload( | |||
owner = _determine_responsible_owner(repository) | |||
|
|||
# If author is on per repo billing, check their repo credits | |||
if owner.plan not in USER_PLAN_REPRESENTATIONS and owner.repo_credits <= 0: | |||
if ( | |||
owner.plan not in Plan.objects.values_list("name", flat=True) |
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 is some mega legacy code, I don't think anyone is on per repo billing anymore and can probably be deleted tbh
@@ -69,17 +71,24 @@ def __getitem__(self, key): | |||
|
|||
|
|||
class StripeWebhookHandlerTests(APITestCase): | |||
@classmethod | |||
def setUpClass(cls): |
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.
beauty
Purpose/Motivation
This PR relies on this version of shared: codecov/shared#479.
The main objective of this PR is to migrate all Backend Service logic to use the new plan and tiers tables instead of the Plan constants. You can read more about milestone 3 here.
A core change introduced in this PR is the creation of mocks for plans and tiers, which are used in most test setup functions. To ensure efficient testing, we use setUpClass to set up these mocks once per test class, avoiding the need to recreate them for each test.
Links to relevant tickets
Closes codecov/engineering-team#3252
What does this PR do?
Include a brief description of the changes in this PR. Bullet points are your friend.
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.