11from django .conf import settings
22from django .db .models import QuerySet
3- from shared .plan .constants import TierName
3+ from shared .plan .constants import TierName , PlanName , PlanPrice
4+ from shared .django_apps .codecov_auth .tests .factories import PlanFactory , TierFactory
5+ from shared .django_apps .codecov_auth .models import BillingRate
46
57from codecov_auth .models import Owner , Plan
68
@@ -26,3 +28,155 @@ def get_all_admins_for_owners(owners: QuerySet[Owner]):
2628
2729 admins : QuerySet [Owner ] = Owner .objects .filter (pk__in = admin_ids )
2830 return admins
31+
32+
33+
34+ def mock_all_plans_and_tiers ():
35+ trial_tier = TierFactory (tier_name = TierName .TRIAL .value )
36+ PlanFactory (
37+ tier = trial_tier ,
38+ name = PlanName .TRIAL_PLAN_NAME .value ,
39+ paid_plan = False ,
40+ marketing_name = "Developer" ,
41+ benefits = [
42+ "Configurable # of users" ,
43+ "Unlimited public repositories" ,
44+ "Unlimited private repositories" ,
45+ "Priority Support" ,
46+ ],
47+ )
48+
49+ basic_tier = TierFactory (tier_name = TierName .BASIC .value )
50+ PlanFactory (
51+ name = PlanName .BASIC_PLAN_NAME .value ,
52+ tier = basic_tier ,
53+ marketing_name = "Developer" ,
54+ benefits = [
55+ "Up to 1 user" ,
56+ "Unlimited public repositories" ,
57+ "Unlimited private repositories" ,
58+ ],
59+ monthly_uploads_limit = 250 ,
60+ )
61+ PlanFactory (
62+ name = PlanName .FREE_PLAN_NAME .value ,
63+ tier = basic_tier ,
64+ marketing_name = "Developer" ,
65+ benefits = [
66+ "Up to 1 user" ,
67+ "Unlimited public repositories" ,
68+ "Unlimited private repositories" ,
69+ ],
70+ )
71+
72+ pro_tier = TierFactory (tier_name = TierName .PRO .value )
73+ PlanFactory (
74+ name = PlanName .CODECOV_PRO_MONTHLY .value ,
75+ tier = pro_tier ,
76+ marketing_name = "Pro" ,
77+ benefits = [
78+ "Configurable # of users" ,
79+ "Unlimited public repositories" ,
80+ "Unlimited private repositories" ,
81+ "Priority Support" ,
82+ ],
83+ billing_rate = BillingRate .MONTHLY .value ,
84+ base_unit_price = PlanPrice .MONTHLY .value ,
85+ paid_plan = True ,
86+ )
87+ PlanFactory (
88+ name = PlanName .CODECOV_PRO_YEARLY .value ,
89+ tier = pro_tier ,
90+ marketing_name = "Pro" ,
91+ benefits = [
92+ "Configurable # of users" ,
93+ "Unlimited public repositories" ,
94+ "Unlimited private repositories" ,
95+ "Priority Support" ,
96+ ],
97+ billing_rate = BillingRate .ANNUALLY .value ,
98+ base_unit_price = PlanPrice .YEARLY .value ,
99+ paid_plan = True ,
100+ )
101+
102+ team_tier = TierFactory (tier_name = TierName .TEAM .value )
103+ PlanFactory (
104+ name = PlanName .TEAM_MONTHLY .value ,
105+ tier = team_tier ,
106+ marketing_name = "Team" ,
107+ benefits = [
108+ "Up to 10 users" ,
109+ "Unlimited repositories" ,
110+ "2500 private repo uploads" ,
111+ "Patch coverage analysis" ,
112+ ],
113+ billing_rate = BillingRate .MONTHLY .value ,
114+ base_unit_price = PlanPrice .TEAM_MONTHLY .value ,
115+ monthly_uploads_limit = 2500 ,
116+ paid_plan = True ,
117+ )
118+ PlanFactory (
119+ name = PlanName .TEAM_YEARLY .value ,
120+ tier = team_tier ,
121+ marketing_name = "Team" ,
122+ benefits = [
123+ "Up to 10 users" ,
124+ "Unlimited repositories" ,
125+ "2500 private repo uploads" ,
126+ "Patch coverage analysis" ,
127+ ],
128+ billing_rate = BillingRate .ANNUALLY .value ,
129+ base_unit_price = PlanPrice .TEAM_YEARLY .value ,
130+ monthly_uploads_limit = 2500 ,
131+ paid_plan = True ,
132+ )
133+
134+ sentry_tier = TierFactory (tier_name = TierName .SENTRY .value )
135+ PlanFactory (
136+ name = PlanName .SENTRY_MONTHLY .value ,
137+ tier = sentry_tier ,
138+ marketing_name = "Sentry Pro" ,
139+ billing_rate = BillingRate .MONTHLY .value ,
140+ base_unit_price = PlanPrice .MONTHLY .value ,
141+ paid_plan = True ,
142+ benefits = [
143+ "Includes 5 seats" ,
144+ "$12 per additional seat" ,
145+ "Unlimited public repositories" ,
146+ "Unlimited private repositories" ,
147+ "Priority Support" ,
148+ ],
149+ )
150+ PlanFactory (
151+ name = PlanName .SENTRY_YEARLY .value ,
152+ tier = sentry_tier ,
153+ marketing_name = "Sentry Pro" ,
154+ billing_rate = BillingRate .ANNUALLY .value ,
155+ base_unit_price = PlanPrice .YEARLY .value ,
156+ paid_plan = True ,
157+ benefits = [
158+ "Includes 5 seats" ,
159+ "$10 per additional seat" ,
160+ "Unlimited public repositories" ,
161+ "Unlimited private repositories" ,
162+ "Priority Support" ,
163+ ],
164+ )
165+
166+ enterprise_tier = TierFactory (tier_name = TierName .ENTERPRISE .value )
167+ PlanFactory (
168+ name = PlanName .ENTERPRISE_CLOUD_MONTHLY .value ,
169+ tier = enterprise_tier ,
170+ marketing_name = "Enterprise" ,
171+ billing_rate = BillingRate .MONTHLY .value ,
172+ base_unit_price = PlanPrice .MONTHLY .value ,
173+ paid_plan = True ,
174+ )
175+ PlanFactory (
176+ name = PlanName .ENTERPRISE_CLOUD_YEARLY .value ,
177+ tier = enterprise_tier ,
178+ marketing_name = "Enterprise" ,
179+ billing_rate = BillingRate .ANNUALLY .value ,
180+ base_unit_price = PlanPrice .YEARLY .value ,
181+ paid_plan = True ,
182+ )
0 commit comments