refactor(fulfillment): 拆分履约服务并修正换绑冷却分类
This commit is contained in:
@@ -856,10 +856,38 @@ def test_deadline_poll_still_checks_role_once_before_timeout(db, monkeypatch):
|
||||
assert task.result["bind_ready_for_confirm"] is True
|
||||
|
||||
|
||||
def test_confirm_bind_maps_platform_cooldown_and_keeps_old_role(
|
||||
db, monkeypatch
|
||||
@pytest.mark.parametrize(
|
||||
("confirm_code", "confirm_message", "expected_issue", "message_markers"),
|
||||
[
|
||||
(
|
||||
-200001,
|
||||
"该平台账号未到可换绑时间,请使用其他平台账号",
|
||||
"account_role_cooldown",
|
||||
("斗鱼账号", "更换斗鱼账号"),
|
||||
),
|
||||
(
|
||||
-200001,
|
||||
"该账号未到可换绑时间,请使用其他账号",
|
||||
"customer_role_cooldown",
|
||||
("待绑定游戏账号", "重新换账号"),
|
||||
),
|
||||
(
|
||||
-1,
|
||||
"系统繁忙,请稍后重试",
|
||||
"binding_failed",
|
||||
("确认绑定失败", "系统繁忙"),
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_confirm_bind_maps_cooldown_and_keeps_old_role(
|
||||
db,
|
||||
monkeypatch,
|
||||
confirm_code,
|
||||
confirm_message,
|
||||
expected_issue,
|
||||
message_markers,
|
||||
):
|
||||
"""2026-11-22 失败 HAR:-200001 是斗鱼账号冷却,旧绑定不能被新角色覆盖。"""
|
||||
"""两类 -200001 必须按原始文案区分,且旧绑定不能被失败角色覆盖。"""
|
||||
_, account, task = _fixtures(db, status="running")
|
||||
old_role = "狗鼻子弗尼亚bd"
|
||||
new_role = "巫师基尔斯84"
|
||||
@@ -900,8 +928,8 @@ def test_confirm_bind_maps_platform_cooldown_and_keeps_old_role(
|
||||
"can_change_role": True,
|
||||
}
|
||||
payload = {
|
||||
"error": -200001,
|
||||
"msg": "该平台账号未到可换绑时间,请使用其他平台账号",
|
||||
"error": confirm_code,
|
||||
"msg": confirm_message,
|
||||
"data": None,
|
||||
}
|
||||
|
||||
@@ -942,13 +970,13 @@ def test_confirm_bind_maps_platform_cooldown_and_keeps_old_role(
|
||||
db.refresh(task)
|
||||
db.refresh(account)
|
||||
assert task.status == "failed"
|
||||
assert task.result["issue_code"] == "account_role_cooldown"
|
||||
assert task.result["confirm_error_code"] == -200001
|
||||
assert task.result["issue_code"] == expected_issue
|
||||
assert task.result["confirm_error_code"] == confirm_code
|
||||
assert task.result["before_bound_bind_info"]["role_name"] == old_role
|
||||
assert task.result["role_name"] == new_role
|
||||
assert task.result["bind_ready_for_confirm"] is False
|
||||
assert "斗鱼账号" in task.message
|
||||
assert "更换斗鱼账号" in task.message
|
||||
for marker in message_markers:
|
||||
assert marker in task.message
|
||||
assert account.game_name == old_role
|
||||
assert account.role_bind_status == "bound"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user