统一推送前Python代码格式

This commit is contained in:
yml2213
2026-09-02 18:11:41 +08:00
parent aaaa568916
commit 95ad900ef0
6 changed files with 265 additions and 124 deletions
+10 -9
View File
@@ -95,14 +95,14 @@ def test_shop_preflight_response_contracts():
def test_wss_requires_web_device_cookie_fields():
assert not HuyaBatchRunnerCore._has_web_wss_cookie(
"udb_cred=x; udb_biztoken=x; udb_uid=1; yyuid=1"
)
assert HuyaBatchRunnerCore._has_web_wss_cookie(
"udb_cred=x; udb_biztoken=x; udb_uid=1; yyuid=1; sdid=s; guid=g; "
"udb_guiddata=gd; udb_deviceid=w_1234567890123456789; game_did=did; "
"_qimei_uuid42=q; udb_anobiztoken=ab; __yamid_new=y"
)
assert not HuyaBatchRunnerCore._has_web_wss_cookie(
"udb_cred=x; udb_biztoken=x; udb_uid=1; yyuid=1"
)
assert HuyaBatchRunnerCore._has_web_wss_cookie(
"udb_cred=x; udb_biztoken=x; udb_uid=1; yyuid=1; sdid=s; guid=g; "
"udb_guiddata=gd; udb_deviceid=w_1234567890123456789; game_did=did; "
"_qimei_uuid42=q; udb_anobiztoken=ab; __yamid_new=y"
)
def test_activity_auth_frame_matches_latest_capture_layout():
@@ -112,6 +112,7 @@ def test_activity_auth_frame_matches_latest_capture_layout():
-> tag3 STRING1 guid(32hex) -> tag4 INT8=1 -> tag5 "HUYA&ZH&2052"
-> tag6 "" -> TAIL_BYTES
"""
async def build_frame():
client = HuyaWssClient()
client._activity_mode = True
@@ -145,7 +146,7 @@ def test_activity_auth_frame_matches_latest_capture_layout():
assert stream.read_string(6) == ""
# body 必须与 9.1 828 AUTH 同样以 TAIL_BYTES 收尾
assert message.body[-len(TAIL_BYTES):] == TAIL_BYTES
assert message.body[-len(TAIL_BYTES) :] == TAIL_BYTES
def test_activity_cookie_guid_is_replaced_by_launch_guid():
+19 -15
View File
@@ -56,9 +56,7 @@ def test_qimei_h38_aliases_uuid42_without_overwriting_existing_value():
assert fields["_qimei_h38"] == uuid42
fields = cookie_fields(
fill_web_cookie_fields(
f"_qimei_uuid42={uuid42}; _qimei_h38=historical", ""
)
fill_web_cookie_fields(f"_qimei_uuid42={uuid42}; _qimei_h38=historical", "")
)
assert fields["_qimei_h38"] == "historical"
@@ -123,12 +121,14 @@ def test_sdk_uuid42_trace_vectors_have_confirmed_outer_layout():
def test_device_profile_builds_stable_webview_feature_approximation():
feature = qimei_feature_from_device_profile({
"vendor": "vivo",
"model": "V2370A",
"width": "1080",
"height": "2412",
})
feature = qimei_feature_from_device_profile(
{
"vendor": "vivo",
"model": "V2370A",
"width": "1080",
"height": "2412",
}
)
assert feature["screen"] == {
"resolution": "1080x2412",
"availResolution": "1080x2412",
@@ -136,11 +136,15 @@ def test_device_profile_builds_stable_webview_feature_approximation():
assert feature["navigator"]["pdfViewerEnabled"] is False
assert "Adreno" in str(feature["webgl"])
first = qimei_fingerprint_generate(feature)
second = qimei_fingerprint_generate(qimei_feature_from_device_profile({
"vendor": "vivo",
"model": "V2370A",
"width": "1080",
"height": "2412",
}))
second = qimei_fingerprint_generate(
qimei_feature_from_device_profile(
{
"vendor": "vivo",
"model": "V2370A",
"width": "1080",
"height": "2412",
}
)
)
assert first == second
assert first != qimei_fingerprint_generate()