File tree 2 files changed +37
-1
lines changed
2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ def get_owner(service, username):
19
19
raise MissingService ()
20
20
21
21
long_service = get_long_service_name (service )
22
- return Owner .objects .filter (username = username , service = long_service ).first ()
22
+ return (
23
+ Owner .objects .filter (username = username , service = long_service )
24
+ .prefetch_related ("account" )
25
+ .first ()
26
+ )
23
27
24
28
25
29
def get_owner_login_sessions (current_user ):
Original file line number Diff line number Diff line change 5
5
from django .test import TransactionTestCase
6
6
from django .utils import timezone
7
7
from freezegun import freeze_time
8
+ from shared .django_apps .codecov_auth .tests .factories import AccountFactory
8
9
from shared .license import LicenseInformation
9
10
from shared .utils .test_utils import mock_config_helper
10
11
@@ -83,6 +84,37 @@ def test_owner_plan_data_when_trialing(self):
83
84
"planUserCount" : 123 ,
84
85
}
85
86
87
+ def test_owner_plan_data_with_account (self ):
88
+ self .current_org .account = AccountFactory (
89
+ plan = PlanName .CODECOV_PRO_YEARLY .value ,
90
+ plan_seat_count = 25 ,
91
+ )
92
+ self .current_org .save ()
93
+ query = """{
94
+ owner(username: "%s") {
95
+ plan {
96
+ marketingName
97
+ planName
98
+ value
99
+ tierName
100
+ billingRate
101
+ baseUnitPrice
102
+ planUserCount
103
+ }
104
+ }
105
+ }
106
+ """ % (self .current_org .username )
107
+ data = self .gql_request (query , owner = self .current_org )
108
+ assert data ["owner" ]["plan" ] == {
109
+ "marketingName" : "Pro" ,
110
+ "planName" : "users-pr-inappy" ,
111
+ "value" : "users-pr-inappy" ,
112
+ "tierName" : "pro" ,
113
+ "billingRate" : "annually" ,
114
+ "baseUnitPrice" : 10 ,
115
+ "planUserCount" : 25 ,
116
+ }
117
+
86
118
def test_owner_plan_data_has_seats_left (self ):
87
119
current_org = OwnerFactory (
88
120
username = "random-plan-user" ,
You can’t perform that action at this time.
0 commit comments