|
|
@@ -9,7 +9,8 @@
|
|
|
5. /store/store.user/renew 改资料后缓存被刷新,且不延长登录时长
|
|
|
6. 登出后 key 删除,旧 token 再访问 401
|
|
|
|
|
|
-前置:Java 服务运行在 18080(yoshop.auth.mode=redis),库内有临时账号 camel_test_admin / 123456。
|
|
|
+前置:Java 服务运行在 18080(yoshop.auth.mode=redis),库内有临时账号 camel_test_admin / 123456
|
|
|
+ (先跑 `python tools/seed_store_user.py add` 创建,跑完 `remove` 清理)。
|
|
|
"""
|
|
|
import json
|
|
|
import socket
|
|
|
@@ -123,6 +124,8 @@ def main():
|
|
|
res = login()
|
|
|
check("登录成功", res.get("status") == 200, json.dumps(res, ensure_ascii=False))
|
|
|
token = (res.get("data") or {}).get("token")
|
|
|
+ # 账号 ID 随库内自增变化,不写死(原为 10992,重建账号后会漂移)
|
|
|
+ uid = (res.get("data") or {}).get("userId")
|
|
|
check("返回 token", isinstance(token, str) and len(token) == 32, str(token))
|
|
|
if not token:
|
|
|
return 1
|
|
|
@@ -139,7 +142,7 @@ def main():
|
|
|
val = {}
|
|
|
if isinstance(val, str):
|
|
|
val = json.loads(val)
|
|
|
- check("value 顶层就是用户字段", val.get("storeUserId") == 10992 and val.get("userName") == USER_NAME,
|
|
|
+ check("value 顶层就是用户字段", val.get("storeUserId") == uid and val.get("userName") == USER_NAME,
|
|
|
json.dumps(val, ensure_ascii=False)[:200])
|
|
|
check("不再有 user / store_id / is_login 包裹",
|
|
|
not ({"user", "store_id", "is_login"} & set(val.keys())), sorted(val.keys()))
|
|
|
@@ -152,7 +155,7 @@ def main():
|
|
|
info = get("/store/store.user/info", token)
|
|
|
user_info = (info.get("data") or {}).get("userInfo") or {}
|
|
|
check("info 返回 200", info.get("status") == 200, json.dumps(info, ensure_ascii=False)[:160])
|
|
|
- check("userInfo 为当前登录用户", user_info.get("storeUserId") == 10992 and user_info.get("userName") == USER_NAME,
|
|
|
+ check("userInfo 为当前登录用户", user_info.get("storeUserId") == uid and user_info.get("userName") == USER_NAME,
|
|
|
json.dumps(user_info, ensure_ascii=False)[:200])
|
|
|
check("roles.isSuper = 0", ((info.get("data") or {}).get("roles") or {}).get("isSuper") == 0,
|
|
|
json.dumps(info.get("data"), ensure_ascii=False)[:160])
|