test: 后端 pytest 测试基建 (Phase0) — 6 用例全绿 + 部署前备份SOP合规
This commit is contained in:
1 parent
9e9c506ba9
commit
13578ba4c2
7 files changed
+89
No files matched your search
@@ -0,0 +1,21 @@
|
||||
"""短信宝脚手架回归(稳定模块,纯函数)。
|
||||
|
||||
验证登录密码 MD5 算法与短信宝约定一致(32 位小写十六进制)。
|
||||
这是短信验证码功能(注册/改密/充值)能连通短信宝的前提。
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
from app.sms_client import smsbao_md5
|
||||
|
||||
|
||||
def test_smsbao_md5_matches_hashlib():
|
||||
samples = ["XHR521yhf", "abc123", "密码测试", ""]
|
||||
for pw in samples:
|
||||
assert smsbao_md5(pw) == hashlib.md5(pw.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def test_smsbao_md5_is_32_lower_hex():
|
||||
out = smsbao_md5("XHR521yhf")
|
||||
assert len(out) == 32
|
||||
assert out == out.lower()
|
||||
assert all(c in "0123456789abcdef" for c in out)
|
||||
Reference in new issue
Block a user