feat(douyu): 查询工作台增加宝典状态与到期时间 (v0.4.28)
This commit is contained in:
@@ -102,6 +102,21 @@ class _QueryHarness(OverviewMixin, BindMixin, DouyuBatchRunnerCore):
|
||||
"points_query": {"raw": {"data": {"willExpireTime": "1800000000"}}},
|
||||
}
|
||||
|
||||
def _refresh_elite_handbook(self, client, account, *, manual_id, rid=""):
|
||||
del client, manual_id, rid
|
||||
if "elite" in self.fail_helpers:
|
||||
raise RuntimeError("模拟宝典接口异常")
|
||||
account.elite_opened = True
|
||||
account.elite_expire_time = 1800000000
|
||||
return {
|
||||
"elite_manual_type": 1,
|
||||
"elite_manual_score": 888,
|
||||
"elite_expire_time": 1800000000,
|
||||
"elite_opened": True,
|
||||
"elite_expired": False,
|
||||
"points": 888,
|
||||
}
|
||||
|
||||
|
||||
class TestQueryAssetsAndBindExecution:
|
||||
def setup_method(self):
|
||||
@@ -177,15 +192,24 @@ class TestQueryAssetsAndBindExecution:
|
||||
self.task,
|
||||
self.account,
|
||||
self.account.cookie,
|
||||
{"bind_act_alias": "B1", "confirm_act_alias": "C1"},
|
||||
{
|
||||
"manual_id": "M1",
|
||||
"rid": "R1",
|
||||
"bind_act_alias": "B1",
|
||||
"confirm_act_alias": "C1",
|
||||
},
|
||||
)
|
||||
assert h.marked["status"] == "success"
|
||||
res = h.marked["result"]
|
||||
assert res["gold_balance"] == 66
|
||||
assert res["exchange_balance"] == 12
|
||||
assert res["points"] == 888
|
||||
assert res["elite_opened"] is True
|
||||
assert res["elite_expire_time"] == 1800000000
|
||||
assert self.account.gold_balance == 66
|
||||
assert self.account.points == 888
|
||||
assert self.account.elite_opened is True
|
||||
assert self.account.elite_expire_time == 1800000000
|
||||
assert self.account.points_expire_at is not None
|
||||
assert self.account.role_bind_status == "bound"
|
||||
assert self.account.game_name == "测试召唤师"
|
||||
@@ -213,7 +237,7 @@ class TestQueryAssetsAndBindExecution:
|
||||
self.task,
|
||||
self.account,
|
||||
self.account.cookie,
|
||||
{"bind_act_alias": "B1"},
|
||||
{"manual_id": "M1", "bind_act_alias": "B1"},
|
||||
)
|
||||
assert h.marked["status"] == "success"
|
||||
assert "gold" in h.marked["result"]["errors"]
|
||||
@@ -231,16 +255,17 @@ class TestQueryAssetsAndBindExecution:
|
||||
"errors": ["角色接口500"],
|
||||
},
|
||||
)
|
||||
h = _QueryHarness(fail_helpers={"gold", "points"})
|
||||
h = _QueryHarness(fail_helpers={"gold", "elite", "points"})
|
||||
h._execute_query_assets_and_bind(
|
||||
self.session,
|
||||
self.task,
|
||||
self.account,
|
||||
self.account.cookie,
|
||||
{},
|
||||
{"manual_id": "M1"},
|
||||
)
|
||||
assert h.marked["status"] == "failed"
|
||||
assert "gold" in h.marked["message"]
|
||||
assert "elite" in h.marked["message"]
|
||||
assert "points" in h.marked["message"]
|
||||
assert "bind" in h.marked["message"]
|
||||
|
||||
@@ -286,6 +311,8 @@ class TestQueryWorkbenchRouterAndExport:
|
||||
game_channel="微信 / 苹果",
|
||||
role_change_available_at=now - timedelta(hours=1),
|
||||
role_change_official_at=now - timedelta(hours=1),
|
||||
elite_opened=True,
|
||||
elite_expire_time=1893456000,
|
||||
assigned_to=self.support_with_login.id,
|
||||
)
|
||||
self.acc_invalid_ck = Account(
|
||||
@@ -303,6 +330,8 @@ class TestQueryWorkbenchRouterAndExport:
|
||||
role_bind_status="bound",
|
||||
game_name="角色B",
|
||||
role_change_available_at=now + timedelta(hours=5),
|
||||
elite_opened=False,
|
||||
elite_expire_time=1,
|
||||
assigned_to=self.support_with_login.id,
|
||||
)
|
||||
self.acc_no_ck = Account(
|
||||
@@ -480,8 +509,12 @@ class TestQueryWorkbenchRouterAndExport:
|
||||
assert rows[2][2] == '\'=HYPERLINK("https://example.invalid")'
|
||||
assert rows[2][8] == "100"
|
||||
assert rows[2][10] == "1280"
|
||||
assert rows[2][15] == "可换绑"
|
||||
assert rows[3][15] == "冷却中"
|
||||
assert rows[1][12] == "未查询"
|
||||
assert rows[2][12] == "已开通"
|
||||
assert rows[2][13].startswith("2030-01-01")
|
||||
assert rows[3][12] == "已过期"
|
||||
assert rows[2][17] == "可换绑"
|
||||
assert rows[3][17] == "冷却中"
|
||||
|
||||
def test_relogin_requires_login_batch_permission(self):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
|
||||
Reference in New Issue
Block a user