Files
rar-autopass/tests/test_idempotency.py
Claude Agent deb6afff3e feat(5.20): US-001/002/003 schema medii per cont + disponibilitate + idempotenta env-aware
US-001: coloane accounts (rar_test/prod_enabled, rar_creds_test/prod_enc,
rar_env_default) + submissions.rar_env; migrare cu backfill din ancora globala
AUTOPASS_RAR_ENV (creds->slot, enabled doar pe mediul cu creds) + recompute
idempotency_key env-aware (AUTO-FIX G + E4/3).
US-002: app/rar_env.py — medii_disponibile + rar_env_efectiv (REQ-DISP/DEFAULT).
US-003: build_key(account_id, canon, rar_env) — test vs prod = trimiteri distincte.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 19:42:28 +00:00

29 lines
878 B
Python

"""US-003 (PRD 5.20): build_key incorporeaza rar_env."""
from __future__ import annotations
from app.idempotency import build_key, canonicalize_row
def _canon():
raw = {
"vin": "WVWZZZ1JZXW000001", "nr_inmatriculare": "B 123 ABC",
"data_prestatie": "2026-01-10", "odometru_final": "123456.0",
"prestatii": [{"cod_prestatie": "OE-1"}],
}
canon = canonicalize_row(raw)
canon["prestatii"] = raw["prestatii"]
return canon
def test_key_difera_intre_test_si_prod():
canon = _canon()
assert build_key(1, canon, "test") != build_key(1, canon, "prod")
def test_key_stabil_pe_env():
canon = _canon()
assert build_key(1, canon, "prod") == build_key(1, canon, "prod")
# None si 1 colapseaza la aceeasi cheie (account_or_default), pe acelasi env
assert build_key(None, canon, "test") == build_key(1, canon, "test")