Curatare globala a comentariilor si docstring-urilor (app, tools, teste, scripturi): eliminate referintele la PRD-uri, US-xxx, task-uri istorice si review-uri; pastrata doar informatia functionala, formulata scurt. Regula adaugata in CLAUDE.md (sectiunea Stil). Fara modificari de cod sau comportament. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
"""medii_disponibile + rar_env_efectiv (REQ-DISP / REQ-DEFAULT)."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.rar_env import medii_disponibile, rar_env_efectiv
|
|
|
|
|
|
def _cont(**kw):
|
|
base = {
|
|
"rar_test_enabled": 0, "rar_prod_enabled": 0,
|
|
"rar_creds_test_enc": None, "rar_creds_prod_enc": None,
|
|
"rar_env_default": "prod",
|
|
}
|
|
base.update(kw)
|
|
return base
|
|
|
|
|
|
def test_doar_prod_cu_creds():
|
|
c = _cont(rar_prod_enabled=1, rar_creds_prod_enc="TOK")
|
|
assert medii_disponibile(c) == ["prod"]
|
|
assert rar_env_efectiv(c) == "prod"
|
|
|
|
|
|
def test_ambele():
|
|
c = _cont(
|
|
rar_test_enabled=1, rar_creds_test_enc="T",
|
|
rar_prod_enabled=1, rar_creds_prod_enc="P",
|
|
rar_env_default="test",
|
|
)
|
|
assert medii_disponibile(c) == ["test", "prod"]
|
|
assert rar_env_efectiv(c) == "test"
|
|
|
|
|
|
def test_zero_cand_lipsesc_creds():
|
|
# activat dar fara creds -> nu e disponibil
|
|
c = _cont(rar_test_enabled=1, rar_prod_enabled=1)
|
|
assert medii_disponibile(c) == []
|
|
assert rar_env_efectiv(c) is None
|
|
|
|
|
|
def test_default_cade_pe_singurul_disponibil():
|
|
# default='prod' dar prod nu e disponibil; doar test e -> efectiv = test
|
|
c = _cont(rar_test_enabled=1, rar_creds_test_enc="T", rar_env_default="prod")
|
|
assert medii_disponibile(c) == ["test"]
|
|
assert rar_env_efectiv(c) == "test"
|
|
|
|
|
|
def test_enabled_fara_creds_nu_e_disponibil():
|
|
c = _cont(rar_prod_enabled=1, rar_creds_prod_enc=" ") # whitespace = gol
|
|
assert medii_disponibile(c) == []
|