优化(账号自动化): 完善受保护账号重登筛选与登录配额分配
This commit is contained in:
@@ -171,3 +171,38 @@ def test_protected_inventory_is_allocated_once_within_daily_budget(db):
|
||||
assert recommended["relogin_protected_daily_limit"] >= 50
|
||||
assert recommended["lease_refresh_daily_limit"] >= 50
|
||||
assert allocated <= recommended["daily_attempt_limit"]
|
||||
|
||||
|
||||
def test_protected_without_cookie_and_captcha_included_in_protected_backlog(db):
|
||||
now = datetime.now(UTC)
|
||||
missing_cookie = _account(
|
||||
"budget-prot-nocookie",
|
||||
cookie="",
|
||||
ck_check_status="",
|
||||
status="imported",
|
||||
)
|
||||
captcha_account = _account(
|
||||
"budget-prot-captcha",
|
||||
ck_check_status="invalid",
|
||||
status="manual",
|
||||
)
|
||||
captcha_account.relogin_failure_kind = "captcha"
|
||||
db.add_all([missing_cookie, captcha_account])
|
||||
db.flush()
|
||||
for idx, acc in enumerate((missing_cookie, captcha_account)):
|
||||
db.add(
|
||||
PlatformFulfillmentTask(
|
||||
source_order_id=f"budget-prot-order-{idx}",
|
||||
source_order_item_id=f"budget-prot-item-{idx}",
|
||||
sale_mode="presale",
|
||||
account_id=acc.id,
|
||||
binding_status="bound",
|
||||
execution_status="bound",
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
recommendation = recommend_login_budget(db, now=now)
|
||||
|
||||
assert recommendation["basis"]["protected_invalid_backlog"] == 2
|
||||
assert recommendation["recommended"]["relogin_protected_daily_limit"] >= 100
|
||||
|
||||
Reference in New Issue
Block a user