feat(5.12): modal editare + cont obligatoriu la import; design.md + PRD 5.13 revizuit (/autoplan)
5.12 (livrat): editare in modal a randurilor de preview, cont obligatoriu inainte de import, formular editare extras (_form_editare, _editare_preview_modal), plus suita de teste aferenta (preview edit/compact, mapare op, form editare, signup, admin panel). Design + planificare: - docs/design.md: sistem de design (tokeni, breakpoints, scara control, componente, a11y). - docs/prd/prd-5.12-* si prd-5.13-* (5.13 cu raport /autoplan: CEO+Design+Eng, audit trail). Curatare: sterse PNG-urile de test/mockup temporare din radacina. Nota: implementarea CSS 5.13 (responsive compact + sistem butoane) NU e inca facuta — planul revizuit cere refactorul testelor fragile din test_web_responsive.py INAINTE de CSS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,4 +112,61 @@ def test_list_accounts_ordonat_fara_creds(conn):
|
||||
assert ids == sorted(ids)
|
||||
for r in rows:
|
||||
assert "rar_creds_enc" not in r
|
||||
assert set(r.keys()) == {"id", "name", "cui", "active", "status", "created_at"}
|
||||
assert set(r.keys()) == {"id", "name", "cui", "email", "active", "status", "created_at"}
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# US-001 (PRD 5.12): accounts.email + validari companie/email/CUI
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_create_account_fara_email_ridica(conn):
|
||||
"""create_account cu email="" ridica ValueError (email gol nu e acceptat)."""
|
||||
from app.accounts import create_account
|
||||
with pytest.raises(ValueError, match="email"):
|
||||
create_account(conn, "Service X", cui="RO100", email="")
|
||||
|
||||
|
||||
def test_create_account_fara_cui_ridica(conn):
|
||||
"""create_account cu cui="" ridica ValueError (CUI gol nu e acceptat)."""
|
||||
from app.accounts import create_account
|
||||
with pytest.raises(ValueError, match="[Cc][Uu][Ii]|cod unic"):
|
||||
create_account(conn, "Service X", cui="", email="test@test.com")
|
||||
|
||||
|
||||
def test_email_normalizat_lowercase_trim(conn):
|
||||
"""email e normalizat: trim + lower."""
|
||||
from app.accounts import create_account
|
||||
acct_id = create_account(conn, "Service X", cui="RO200", email=" Test@EXAMPLE.Com ")
|
||||
row = conn.execute("SELECT email FROM accounts WHERE id=?", (acct_id,)).fetchone()
|
||||
assert row["email"] == "test@example.com"
|
||||
|
||||
|
||||
def test_migrare_adauga_coloana_email_idempotent(conn):
|
||||
"""_migrate e idempotent: ruleaza de doua ori fara eroare si coloana email exista."""
|
||||
from app.db import _migrate
|
||||
_migrate(conn) # a doua rulare (prima e in init_db)
|
||||
cols = {r["name"] for r in conn.execute("PRAGMA table_info(accounts)").fetchall()}
|
||||
assert "email" in cols
|
||||
|
||||
|
||||
def test_account_is_complete_false_pe_legacy_incomplet(conn):
|
||||
"""account_is_complete() returneaza False pe cont fara email sau fara CUI."""
|
||||
from app.accounts import create_account, account_is_complete
|
||||
# cont fara email si fara CUI
|
||||
acct_id = create_account(conn, "Service Legacy")
|
||||
row = conn.execute("SELECT * FROM accounts WHERE id=?", (acct_id,)).fetchone()
|
||||
assert account_is_complete(row) is False
|
||||
|
||||
# cont fara email, cu CUI
|
||||
acct_id2 = create_account(conn, "Service Cu CUI", cui="RO300")
|
||||
row2 = conn.execute("SELECT * FROM accounts WHERE id=?", (acct_id2,)).fetchone()
|
||||
assert account_is_complete(row2) is False
|
||||
|
||||
# cont complet (cu email si CUI si name)
|
||||
acct_id3 = create_account(conn, "Service Complet", cui="RO301", email="x@y.com")
|
||||
row3 = conn.execute("SELECT * FROM accounts WHERE id=?", (acct_id3,)).fetchone()
|
||||
assert account_is_complete(row3) is True
|
||||
|
||||
# contul sistem id=1 e EXCEPTAT (returneaza True indiferent)
|
||||
row_sys = conn.execute("SELECT * FROM accounts WHERE id=1").fetchone()
|
||||
assert account_is_complete(row_sys) is True
|
||||
|
||||
Reference in New Issue
Block a user