feat(huya): 协作台账补资料与管理员复制 CK

This commit is contained in:
yml2213
2026-10-17 20:47:31 +08:00
parent 8fac4a1d04
commit f06869c4b1
4 changed files with 528 additions and 28 deletions
+17
View File
@@ -2055,6 +2055,23 @@ class TestCollabCkExport(TestCollabBase):
collab.export_cks(self.db, self.user, [None] * (collab.PROBE_BATCH_MAX + 1))
assert excinfo.value.code == "ck_export_too_large"
def test_single_row_copy_is_super_admin_only(self):
"""操作列「复制 CK」只给管理员;运营/客服即使有导出权限也不能走这个入口。"""
order = self._create(order_no="EXP-ADMIN-1", ck_text=fake_ck("1199647000099"))
with pytest.raises(collab_api.HTTPException) as excinfo:
collab_api.copy_external_order_ck(order.id, self.db, self.user)
assert excinfo.value.status_code == 403
admin = User(username="collab_admin", password_hash="h", role="super_admin")
self.db.add(admin)
self.db.commit()
result = collab_api.copy_external_order_ck(order.id, self.db, admin)
assert result["exported"] == 1
assert result["items"][0]["order_no"] == "EXP-ADMIN-1"
assert result["items"][0]["ck_text"] == order.cookie
assert self._audits(order)[-1].username == "collab_admin"
class TestProbeCache(TestCollabBase):
def test_same_ck_probed_twice_only_hits_the_api_once(self, monkeypatch):