1414 OwnerFactory ,
1515 UserFactory ,
1616)
17- from shared .plan .constants import PlanName , TrialStatus
17+ from shared .plan .constants import DEFAULT_FREE_PLAN , PlanName , TrialStatus
1818from stripe import StripeError
1919
2020from api .internal .tests .test_utils import GetAdminProviderAdapter
@@ -185,7 +185,7 @@ def test_retrieve_account_gets_account_fields(self):
185185 "inactive_user_count" : 1 ,
186186 "plan" : {
187187 "marketing_name" : "Developer" ,
188- "value" : PlanName . BASIC_PLAN_NAME . value ,
188+ "value" : DEFAULT_FREE_PLAN ,
189189 "billing_rate" : None ,
190190 "base_unit_price" : 0 ,
191191 "benefits" : [
@@ -234,7 +234,7 @@ def test_retrieve_account_gets_account_fields_when_there_are_scheduled_details(
234234 schedule_params = {
235235 "id" : 123 ,
236236 "start_date" : 123689126736 ,
237- "stripe_plan_id" : "plan_H6P3KZXwmAbqPS " ,
237+ "stripe_plan_id" : "plan_pro_yearly " ,
238238 "quantity" : 6 ,
239239 }
240240 phases = [
@@ -270,7 +270,7 @@ def test_retrieve_account_gets_account_fields_when_there_are_scheduled_details(
270270 "plan_provider" : owner .plan_provider ,
271271 "plan" : {
272272 "marketing_name" : "Developer" ,
273- "value" : PlanName . BASIC_PLAN_NAME . value ,
273+ "value" : DEFAULT_FREE_PLAN ,
274274 "billing_rate" : None ,
275275 "base_unit_price" : 0 ,
276276 "benefits" : [
@@ -330,7 +330,7 @@ def test_retrieve_account_returns_last_phase_when_more_than_one_scheduled_phases
330330 schedule_params = {
331331 "id" : 123 ,
332332 "start_date" : 123689126736 ,
333- "stripe_plan_id" : "plan_H6P3KZXwmAbqPS " ,
333+ "stripe_plan_id" : "plan_pro_yearly " ,
334334 "quantity" : 6 ,
335335 }
336336 phases = [
@@ -367,7 +367,7 @@ def test_retrieve_account_returns_last_phase_when_more_than_one_scheduled_phases
367367 "inactive_user_count" : 1 ,
368368 "plan" : {
369369 "marketing_name" : "Developer" ,
370- "value" : PlanName . BASIC_PLAN_NAME . value ,
370+ "value" : DEFAULT_FREE_PLAN ,
371371 "billing_rate" : None ,
372372 "base_unit_price" : 0 ,
373373 "benefits" : [
@@ -441,7 +441,7 @@ def test_retrieve_account_gets_none_for_schedule_details_when_schedule_is_nonexi
441441 "inactive_user_count" : 1 ,
442442 "plan" : {
443443 "marketing_name" : "Developer" ,
444- "value" : PlanName . BASIC_PLAN_NAME . value ,
444+ "value" : DEFAULT_FREE_PLAN ,
445445 "billing_rate" : None ,
446446 "base_unit_price" : 0 ,
447447 "benefits" : [
@@ -509,13 +509,13 @@ def test_retrieve_account_gets_account_students(self):
509509 }
510510
511511 def test_account_with_free_user_plan (self ):
512- self .current_owner .plan = PlanName . BASIC_PLAN_NAME . value
512+ self .current_owner .plan = DEFAULT_FREE_PLAN
513513 self .current_owner .save ()
514514 response = self ._retrieve ()
515515 assert response .status_code == status .HTTP_200_OK
516516 assert response .data ["plan" ] == {
517517 "marketing_name" : "Developer" ,
518- "value" : PlanName . BASIC_PLAN_NAME . value ,
518+ "value" : DEFAULT_FREE_PLAN ,
519519 "billing_rate" : None ,
520520 "base_unit_price" : 0 ,
521521 "benefits" : [
@@ -711,7 +711,7 @@ def test_update_can_set_plan_auto_activate_on_org_with_account(self):
711711 assert self .current_owner .plan_auto_activate is False
712712 assert response .data ["plan_auto_activate" ] is False
713713
714- def test_update_can_set_plan_to_users_basic (self ):
714+ def test_update_can_set_plan_to_users_developer_should_set_to_developer (self ):
715715 self .current_owner .plan = PlanName .CODECOV_PRO_YEARLY .value
716716 self .current_owner .save ()
717717
@@ -720,14 +720,14 @@ def test_update_can_set_plan_to_users_basic(self):
720720 "service" : self .current_owner .service ,
721721 "owner_username" : self .current_owner .username ,
722722 },
723- data = {"plan" : {"value" : PlanName . BASIC_PLAN_NAME . value }},
723+ data = {"plan" : {"value" : DEFAULT_FREE_PLAN }},
724724 )
725725
726726 assert response .status_code == status .HTTP_200_OK
727727
728728 self .current_owner .refresh_from_db ()
729729
730- assert self .current_owner .plan == PlanName . BASIC_PLAN_NAME . value
730+ assert self .current_owner .plan == DEFAULT_FREE_PLAN
731731 assert self .current_owner .plan_activated_users is None
732732 assert self .current_owner .plan_user_count == 1
733733 assert response .data ["plan_auto_activate" ] is True
@@ -984,7 +984,7 @@ def test_update_must_fail_if_quantity_and_plan_are_equal_to_the_owners_current_o
984984 )
985985
986986 def test_update_team_plan_must_fail_if_too_many_activated_users_during_trial (self ):
987- self .current_owner .plan = PlanName . BASIC_PLAN_NAME . value
987+ self .current_owner .plan = DEFAULT_FREE_PLAN
988988 self .current_owner .plan_user_count = 1
989989 self .current_owner .trial_status = TrialStatus .ONGOING .value
990990 self .current_owner .plan_activated_users = list (range (11 ))
@@ -1005,13 +1005,7 @@ def test_update_team_plan_must_fail_if_too_many_activated_users_during_trial(sel
10051005 )
10061006
10071007 assert response .status_code == status .HTTP_400_BAD_REQUEST
1008- assert response .json () == {
1009- "plan" : {
1010- "value" : [
1011- f"Invalid value for plan: { desired_plan ['value' ]} ; must be one of ['users-basic', 'users-pr-inappm', 'users-pr-inappy']"
1012- ]
1013- }
1014- }
1008+ assert "Invalid value for plan:" in response .json ()["plan" ]["value" ][0 ]
10151009
10161010 def test_update_team_plan_must_fail_if_currently_team_plan_add_too_many_users (self ):
10171011 self .current_owner .plan = PlanName .TEAM_MONTHLY .value
@@ -1602,7 +1596,7 @@ def test_update_sentry_plan_non_sentry_user(
16021596 assert res .json () == {
16031597 "plan" : {
16041598 "value" : [
1605- "Invalid value for plan: users-sentrym; must be one of ['users-basic', 'users- pr-inappm', 'users-pr-inappy', 'users-teamm', 'users-teamy']"
1599+ f "Invalid value for plan: users-sentrym; must be one of ['users-pr-inappm', 'users-pr-inappy', 'users-teamm', 'users-teamy', ' { DEFAULT_FREE_PLAN } ']"
16061600 ]
16071601 }
16081602 }
0 commit comments