Adauga tests/test_live_rar.py: reproduce automat proba live a maparii inline (needs_mapping -> mapare inline web cu sesiune+CSRF -> queued -> worker real login RAR + postPrezentare -> sent -> verificare in finalizate RAR). Skip implicit (marker `live`), opt-in cu AUTOPASS_LIVE_RAR=1 + creds <test>. - conftest.py: inregistreaza markerul `live` (excludere -m "not live") - ROADMAP/CLAUDE.md: 5.7 NEPROBAT -> PROBAT (manual idPrezentare=68827, automatizat idPrezentare=68828) + comenzi rulare test live pytest -q: 765 passed, 1 skipped (live). Test live verde pe RAR test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
26 lines
1.2 KiB
Python
26 lines
1.2 KiB
Python
"""Configurare pytest la nivel de suita: izoleaza testele de `.env`-ul de dezvoltare.
|
|
|
|
In working-dir exista un `.env` pentru probe live (ex. `AUTOPASS_REQUIRE_API_KEY=true`,
|
|
`AUTOPASS_WORKER_USE_TEST_CREDS=true`, creds RAR de test) care e citit automat de
|
|
pydantic Settings. Fara izolare, acele flag-uri ar regla tacit comportamentul
|
|
testelor: 401 pe rutele protejate si creds <test> in loc de fallback-ul pe cont.
|
|
|
|
Fixam un default sigur pe variabilele de mediu — care au PRECEDENTA peste fisierul
|
|
`.env` in pydantic-settings — deci neutralizam doar valorile din fisier, nu si o
|
|
variabila exportata explicit in shell. Testele care chiar verifica enforcement-ul
|
|
(auth pornit, creds <test>) il seteaza punctual prin `monkeypatch`/`object.__setattr__`.
|
|
"""
|
|
|
|
import os
|
|
|
|
os.environ.setdefault("AUTOPASS_REQUIRE_API_KEY", "false")
|
|
os.environ.setdefault("AUTOPASS_WORKER_USE_TEST_CREDS", "false")
|
|
|
|
|
|
def pytest_configure(config):
|
|
"""Markeri custom. `live` = teste care ating endpoint-ul real RAR (opt-in,
|
|
skip implicit; vezi tests/test_live_rar.py). Excludere: `-m 'not live'`."""
|
|
config.addinivalue_line(
|
|
"markers", "live: test live pe RAR test (necesita AUTOPASS_LIVE_RAR=1 + creds reale)"
|
|
)
|