17 lines
499 B
Python
17 lines
499 B
Python
import hashlib
|
|
|
|
from ai_platform.lead_scoring.application.run_use_cases import canonical
|
|
from ai_platform.platform.security import digest
|
|
|
|
|
|
def test_canonical_body_fingerprint_ignores_mapping_key_order():
|
|
left = hashlib.sha256(canonical({"a": 1, "b": 2})).digest()
|
|
right = hashlib.sha256(canonical({"b": 2, "a": 1})).digest()
|
|
assert left == right
|
|
|
|
|
|
def test_secret_digest_is_one_way_verifier():
|
|
raw = "tnt_example"
|
|
assert digest(raw) != raw
|
|
assert digest(raw) == digest(raw)
|