test(设备端): 完整昵称缓存不被轮询打码名覆盖的用例 + 文档
This commit is contained in:
@@ -21,8 +21,9 @@ sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspa
|
||||
os.chdir(sys.path[0])
|
||||
|
||||
from flask import Flask # noqa: E402
|
||||
from core.models import db, init_db, DeviceAccount # noqa: E402
|
||||
from core.models import db, init_db, DeviceAccount, Device # noqa: E402
|
||||
from core import account_folder as af # noqa: E402
|
||||
from core import account_probe as ap # noqa: E402
|
||||
from core import device_pool # noqa: E402
|
||||
from tasks.generic import task as gt # noqa: E402
|
||||
|
||||
@@ -177,6 +178,21 @@ check("元素不存在 = 没检出异常 → 写「正常」",
|
||||
DeviceAccount.query.filter_by(nickname="周周苏州吃喝玩乐").first().account_status,
|
||||
"正常")
|
||||
|
||||
print("▶ ⑥ 完整昵称缓存:轮询的打码名不覆盖完整名")
|
||||
db.session.add(Device(serial="A11:5555", name="A11", enabled=True))
|
||||
db.session.commit()
|
||||
check("广播后记住完整名", ap.remember_name("A11:5555", "锋哥苏州百业探访"), True)
|
||||
check("Device 行里是完整名",
|
||||
Device.query.get("A11:5555").cur_account_name, "锋哥苏州百业探访")
|
||||
ap.cache_names({"A11:5555": {"name": "锋哥苏***探访"}})
|
||||
db.session.expire_all()
|
||||
check("匹配的打码名不覆盖完整名",
|
||||
Device.query.get("A11:5555").cur_account_name, "锋哥苏州百业探访")
|
||||
ap.cache_names({"A11:5555": {"name": "周周苏***探访"}})
|
||||
db.session.expire_all()
|
||||
check("换了号(打码名对不上)→ 更新成新探测值",
|
||||
Device.query.get("A11:5555").cur_account_name, "周周苏***探访")
|
||||
|
||||
print()
|
||||
if fails:
|
||||
print("❌ 失败 %d 项:%s" % (len(fails), "、".join(fails)))
|
||||
|
||||
Reference in New Issue
Block a user