Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 50d5dbd

Browse files
committed
resolve failing tests
1 parent 6834725 commit 50d5dbd

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

api/internal/owner/views.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from rest_framework.exceptions import PermissionDenied, ValidationError
88
from rest_framework.response import Response
99
from shared.django_apps.codecov_auth.models import Owner
10-
from shared.plan.constants import DEFAULT_FREE_PLAN
1110

1211
from api.shared.mixins import OwnerPropertyMixin
1312
from api.shared.owner.mixins import OwnerViewSetMixin, UserViewSetMixin
@@ -47,10 +46,10 @@ def retrieve(self, *args, **kwargs):
4746

4847
@stripe_safe
4948
def update(self, request, *args, **kwargs):
50-
# Temporary fix. Remove once Gazebo uses the new free plan
51-
plan_value = request.data.get("plan", {}).get("value")
52-
if plan_value == "users-basic":
53-
request.data["plan"]["value"] = DEFAULT_FREE_PLAN
49+
# # Temporary fix. Remove once Gazebo uses the new free plan
50+
# plan_value = request.data.get("plan", {}).get("value")
51+
# if plan_value == "users-basic":
52+
# request.data["plan"]["value"] = DEFAULT_FREE_PLAN
5453

5554
return super().update(request, *args, **kwargs)
5655

api/internal/tests/views/test_account_viewset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ def test_update_can_set_plan_auto_activate_on_org_with_account(self):
690690
assert self.current_owner.plan_auto_activate is False
691691
assert response.data["plan_auto_activate"] is False
692692

693-
def test_update_can_set_plan_to_users_basic_should_set_to_developer(self):
693+
def test_update_can_set_plan_to_users_developer_should_set_to_developer(self):
694694
self.current_owner.plan = PlanName.CODECOV_PRO_YEARLY.value
695695
self.current_owner.save()
696696

@@ -699,7 +699,7 @@ def test_update_can_set_plan_to_users_basic_should_set_to_developer(self):
699699
"service": self.current_owner.service,
700700
"owner_username": self.current_owner.username,
701701
},
702-
data={"plan": {"value": PlanName.BASIC_PLAN_NAME.value}},
702+
data={"plan": {"value": DEFAULT_FREE_PLAN}},
703703
)
704704

705705
assert response.status_code == status.HTTP_200_OK

graphql_api/types/owner/owner.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from ariadne import ObjectType
99
from django.conf import settings
1010
from graphql import GraphQLResolveInfo
11-
from shared.plan.constants import PlanData, PlanName, convert_to_DTO
11+
from shared.plan.constants import DEFAULT_FREE_PLAN, PlanData, convert_to_DTO
1212
from shared.plan.service import PlanService
1313

1414
import services.activation as activation
@@ -113,9 +113,7 @@ def resolve_plan(owner: Owner, info: GraphQLResolveInfo) -> PlanService:
113113
@sync_to_async
114114
def resolve_plan_representation(owner: Owner, info: GraphQLResolveInfo) -> PlanData:
115115
info.context["plan_service"] = PlanService(current_org=owner)
116-
free_plan = Plan.objects.select_related("tier").get(
117-
name=PlanName.BASIC_PLAN_NAME.value
118-
)
116+
free_plan = Plan.objects.select_related("tier").get(name=DEFAULT_FREE_PLAN)
119117
return convert_to_DTO(free_plan)
120118

121119

0 commit comments

Comments
 (0)