feat: 落实决策216/219/227取价锚点与公式口径,增加商业版权益和源码完整性校验

This commit is contained in:
lianjianwei2024
2026-10-27 12:16:47 +08:00
parent 5d9eaf774b
commit 380a39f8db
36 changed files with 18821 additions and 879 deletions

View File

@@ -275,3 +275,26 @@ def test_secret_never_in_error_messages(priv_key, client):
client._tp.script.append(ConnectionError("boom"))
r = client.heartbeat()
assert "SECRET-DO-NOT-LOG" not in r.get("message", "")
# ------------------------------------------------------------ 商业版权益透出(2026-10-27)
def test_status_exposes_entitlements(priv_key, client):
"""激活企业版证书 → status 透出 edition/max_seats;未激活时为 None。"""
assert client.status().get("edition") is None # 未激活
client._tp.script.append(ok_cert(priv_key))
assert client.activate()["ok"] is True
# 缺省证书(无权益字段)→ personal/1
st = client.status()
assert st["edition"] == "personal" and st["max_seats"] == 1
def test_status_exposes_enterprise_entitlements(priv_key, tmp_path, keyring):
from lic_helpers import FakeTransport, MemSecret, make_client, cert_payload, envelope
c = make_client(tmp_path, keyring,
FakeTransport([(200, {}, {"data": {"instance_id": IID, "status": "activated",
"certificate": envelope(cert_payload(edition="enterprise", max_seats=10),
priv_key, "cert")}})]))
assert c.activate()["ok"] is True
st = c.status()
assert st["edition"] == "enterprise" and st["max_seats"] == 10