"""短信宝脚手架回归(稳定模块,纯函数)。 验证登录密码 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)