修复(履约绑定): 后台人工绑定也必须先有客户游戏资料

- 工作台 start/confirm/代确认/强制确认入口统一校验角色和主页截图
- 仅 clean 任务强制,历史任务保持兼容
- 补充后台绑定资料校验测试
This commit is contained in:
yml
2026-11-25 14:35:20 +08:00
parent 3d8a3ff0fc
commit d1c8580cf3
4 changed files with 26 additions and 2 deletions
+14 -1
View File
@@ -3856,6 +3856,15 @@ class TestBindingAndCompletion(_Base):
assert captured["job_type"] == "douyu_binding"
assert captured["batch_id"].startswith(f"pfbind-{task.id}-")
def test_admin_binding_requires_game_home_profile(self):
task = self._allocated()
with pytest.raises(HTTPException) as exc_info:
service.ensure_customer_profile_for_binding(self.session, task_id=task.id)
assert exc_info.value.status_code == 409
self.complete_customer_profile(task)
service.ensure_customer_profile_for_binding(self.session, task_id=task.id)
def test_customer_start_requires_game_home_profile(self):
task = self._allocated()
@@ -3876,6 +3885,9 @@ class TestBindingAndCompletion(_Base):
)
barrier = threading.Barrier(2)
errors: list[BaseException] = []
first_session = make_test_session(self.engine)
first_admin = first_session.get(User, self.admin_id)
assert first_admin is not None
other_session = make_test_session(self.engine)
other_admin = other_session.get(User, self.admin_id)
assert other_admin is not None
@@ -3893,12 +3905,13 @@ class TestBindingAndCompletion(_Base):
except BaseException as exc: # noqa: BLE001 - surfaced below
errors.append(exc)
first = threading.Thread(target=start, args=(self.session, self.admin))
first = threading.Thread(target=start, args=(first_session, first_admin))
second = threading.Thread(target=start, args=(other_session, other_admin))
first.start()
second.start()
first.join(timeout=10)
second.join(timeout=10)
first_session.close()
other_session.close()
assert not first.is_alive()