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

Commit d26259a

Browse files
committed
update tests
1 parent 3a5b3af commit d26259a

File tree

1 file changed

+39
-26
lines changed

1 file changed

+39
-26
lines changed

api/internal/tests/views/test_account_viewset.py

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,14 @@ def test_retrieve_account_gets_account_fields(self):
189189
def test_retrieve_account_gets_account_fields_when_there_are_scheduled_details(
190190
self, mock_retrieve_subscription, mock_retrieve_schedule
191191
):
192-
tier = TierFactory(tier_name=TierName.BASIC.value)
192+
pro_tier = TierFactory(tier_name=TierName.PRO.value)
193193

194194
PlanFactory(
195-
name="users-basic",
196-
tier=tier,
195+
name="users-pr-inappm",
196+
tier=pro_tier,
197197
is_active=True,
198+
billing_rate="monthly",
199+
marketing_name="Pro",
198200
)
199201
owner = OwnerFactory(
200202
admins=[self.current_owner.ownerid], stripe_subscription_id="sub_123"
@@ -238,15 +240,22 @@ def test_retrieve_account_gets_account_fields_when_there_are_scheduled_details(
238240
kwargs={"service": owner.service, "owner_username": owner.username}
239241
)
240242
assert response.status_code == status.HTTP_200_OK
243+
print(response.data)
241244
assert response.data == {
242-
"activated_user_count": 0,
243-
"root_organization": None,
244245
"integration_id": owner.integration_id,
245-
"plan_auto_activate": owner.plan_auto_activate,
246+
"activated_student_count": 0,
247+
"activated_user_count": 0,
248+
"checkout_session_id": None,
249+
"delinquent": None,
250+
"email": owner.email,
246251
"inactive_user_count": 1,
252+
"name": owner.name,
253+
"nb_active_private_repos": 0,
254+
"plan_auto_activate": True,
255+
"plan_provider": owner.plan_provider,
247256
"plan": {
248257
"marketing_name": "Developer",
249-
"value": PlanName.BASIC_PLAN_NAME.value,
258+
"value": "users-basic",
250259
"billing_rate": None,
251260
"base_unit_price": 0,
252261
"benefits": [
@@ -256,41 +265,45 @@ def test_retrieve_account_gets_account_fields_when_there_are_scheduled_details(
256265
],
257266
"quantity": 1,
258267
},
268+
"repo_total_credits": 99999999,
269+
"root_organization": None,
270+
"schedule_detail": {
271+
"id": "123",
272+
"scheduled_phase": {
273+
"start_date": schedule_params["start_date"],
274+
"plan": "Pro",
275+
"quantity": schedule_params["quantity"],
276+
},
277+
},
278+
"student_count": 0,
259279
"subscription_detail": {
260280
"latest_invoice": None,
261281
"default_payment_method": None,
262282
"cancel_at_period_end": False,
263283
"current_period_end": 1633512445,
264284
"customer": {"id": "cus_LK&*Hli8YLIO", "discount": None, "email": None},
265285
"collection_method": "charge_automatically",
266-
"trial_end": None,
267286
"tax_ids": None,
268-
},
269-
"checkout_session_id": None,
270-
"name": owner.name,
271-
"email": owner.email,
272-
"nb_active_private_repos": 0,
273-
"repo_total_credits": 99999999,
274-
"plan_provider": owner.plan_provider,
275-
"activated_student_count": 0,
276-
"student_count": 0,
277-
"schedule_detail": {
278-
"id": "123",
279-
"scheduled_phase": {
280-
"plan": "monthly",
281-
"quantity": schedule_params["quantity"],
282-
"start_date": schedule_params["start_date"],
283-
},
287+
"trial_end": None,
284288
},
285289
"uses_invoice": False,
286-
"delinquent": None,
287290
}
288291

289292
@patch("services.billing.stripe.SubscriptionSchedule.retrieve")
290293
@patch("services.billing.stripe.Subscription.retrieve")
291294
def test_retrieve_account_returns_last_phase_when_more_than_one_scheduled_phases(
292295
self, mock_retrieve_subscription, mock_retrieve_schedule
293296
):
297+
pro_tier = TierFactory(tier_name=TierName.PRO.value)
298+
299+
PlanFactory(
300+
name="users-pr-inappm",
301+
tier=pro_tier,
302+
is_active=True,
303+
billing_rate="monthly",
304+
marketing_name="Pro",
305+
)
306+
294307
owner = OwnerFactory(
295308
admins=[self.current_owner.ownerid], stripe_subscription_id="sub_2345687"
296309
)
@@ -380,7 +393,7 @@ def test_retrieve_account_returns_last_phase_when_more_than_one_scheduled_phases
380393
"schedule_detail": {
381394
"id": "123",
382395
"scheduled_phase": {
383-
"plan": "monthly",
396+
"plan": "Pro",
384397
"quantity": schedule_params["quantity"],
385398
"start_date": schedule_params["start_date"],
386399
},

0 commit comments

Comments
 (0)