fix(fulfillment): 人工确认必须匹配账号当前角色
- 账号当前角色与确认角色不一致时拒绝人工确认 - 前端不一致时禁用确认并提示 - 补充角色不匹配回归测试 - 记录订单 2632801603123492 强制确认问题
This commit is contained in:
@@ -3089,6 +3089,50 @@ class TestBindingAndCompletion(_Base):
|
||||
== 1
|
||||
)
|
||||
|
||||
def test_manual_confirm_rejects_role_not_currently_bound(self):
|
||||
task = self._allocated()
|
||||
account = self.session.get(Account, task.account_id)
|
||||
account.game_name = "小乖悄"
|
||||
account.role_bind_status = "bound"
|
||||
qr_task = DouyuTask(
|
||||
batch_id="manual-mismatch-qr",
|
||||
account_id=task.account_id,
|
||||
account_assigned_to=self.admin_id,
|
||||
task_type="get_bind_qr",
|
||||
handbook_scope="elite",
|
||||
status="success",
|
||||
platform_task_id=task.id,
|
||||
result={"bind_phase": "waiting_scan", "role_name": "等清晰"},
|
||||
created_by=self.admin_id,
|
||||
)
|
||||
self.session.add(qr_task)
|
||||
self.session.flush()
|
||||
task.bind_task_id = qr_task.id
|
||||
task.binding_status = "qr_pending"
|
||||
task.execution_status = "waiting_bind"
|
||||
self.session.commit()
|
||||
|
||||
with pytest.raises(HTTPException) as exc_info:
|
||||
service.manual_confirm_binding_sync(
|
||||
self.session,
|
||||
task_id=task.id,
|
||||
current=self.admin,
|
||||
role_name="等清晰",
|
||||
note="客户说角色是等清晰",
|
||||
)
|
||||
|
||||
self.session.refresh(task)
|
||||
assert exc_info.value.status_code == 409
|
||||
assert "不一致" in str(exc_info.value.detail)
|
||||
assert task.binding_status == "qr_pending"
|
||||
assert task.execution_status == "waiting_bind"
|
||||
assert (
|
||||
self.session.query(PlatformFulfillmentEvent)
|
||||
.filter_by(task_id=task.id, event_type="binding_manually_confirmed")
|
||||
.count()
|
||||
== 0
|
||||
)
|
||||
|
||||
def test_cjm_only_new_role_enters_role_ready_for_customer_confirm(self):
|
||||
task = self._allocated()
|
||||
qr_task = DouyuTask(
|
||||
|
||||
Reference in New Issue
Block a user