fix(douyu): 优先使用旧版角色绑定入口

This commit is contained in:
yml
2026-11-22 18:51:44 +08:00
parent 22e106bf9b
commit 6a0e88055d
2 changed files with 32 additions and 3 deletions
+24 -1
View File
@@ -528,7 +528,8 @@ def test_qr_and_confirm_requests_follow_latest_har(monkeypatch):
qr = client.get_bind_qr(ACT_ALIAS)
confirmed = client.confirm_bind(ACT_ALIAS)
assert qr["url"] == "https://livelink.example/role"
assert qr["url"] == "https://livelink.example/bind"
assert qr["role_param_url"] == "https://livelink.example/role"
assert qr["game_role_bind_url"] == "https://livelink.example/bind"
assert confirmed["ctn"] == "ctn"
assert calls[0]["method"] == "get"
@@ -566,3 +567,25 @@ def test_confirm_bind_preserves_platform_cooldown_error_code(monkeypatch):
assert exc_info.value.code == -200001
assert exc_info.value.payload == payload
def test_get_bind_qr_falls_back_to_role_param_url(monkeypatch):
client = DouyuActivityClient("acf_ccn=ctn")
monkeypatch.setattr(
client,
"acf_ccn",
lambda *, refresh_subscribe=True: "ctn",
)
monkeypatch.setattr(
client,
"_request_json",
lambda *_args, **_kwargs: {
"error": 0,
"data": {"url": "https://livelink.example/role"},
},
)
qr = client.get_bind_qr(ACT_ALIAS)
assert qr["url"] == "https://livelink.example/role"
assert qr["game_role_bind_url"] == ""