Skip to content

Commit 96d817e

Browse files
committed
tests: add add-minutes event test
1 parent 5015426 commit 96d817e

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

backend/test/test_org_subs.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,3 +915,41 @@ def test_subscription_events_log_filter_sort(admin_auth_headers):
915915
assert last_id >= cancel_date
916916
if cancel_date:
917917
last_date = cancel_date
918+
919+
920+
def test_subscription_add_minutes(admin_auth_headers):
921+
r = requests.post(
922+
f"{API_PREFIX}/subscriptions/add-minutes",
923+
headers=admin_auth_headers,
924+
json={
925+
"oid": new_subs_oid,
926+
"minutes": 75,
927+
"total_price": 350,
928+
"currency": "usd",
929+
"context": "addon",
930+
},
931+
)
932+
933+
assert r.status_code == 200
934+
assert r.json() == {"updated": True}
935+
936+
r = requests.post(
937+
f"{API_PREFIX}/orgs/{new_subs_oid}",
938+
headers=admin_auth_headers,
939+
)
940+
941+
assert r.status_code == 200
942+
quota_updates = r.json()["quotaUpdates"]
943+
assert len(quota_updates)
944+
last_update = quota_updates[len(quota_updates) - 1]
945+
946+
assert last_update["type"] == "add-minutes"
947+
assert last_update["context"] == "addon"
948+
assert last_update["update"] == {
949+
"maxPagesPerCrawl": 50,
950+
"storageQuota": 500000,
951+
"extraExecMinutes": 75, # only this value updated from previous
952+
"giftedExecMinutes": 0,
953+
"maxConcurrentCrawls": 1,
954+
"maxExecMinutesPerMonth": 1000,
955+
}

0 commit comments

Comments
 (0)