"""Teste US-012 / US-012b / US-012c (PRD 5.10): Header logo ROMFAST + titlu centrat.
TDD: testele se scriu INAINTE de implementare (RED), dupa implementare trec (GREEN).
US-012b (decizie user): logo PNG real (/static/romfast_logo.png) in loc de wordmark text.
US-012c (decizie user): logo mutat din header-center in header-left (brand top-left ca pe romfast.ro).
Decizie env badge: mutat in header-center (sub
, mic, color:var(--muted)) — nu suprapune
logo-ul si pastreaza centrarea optica a titlului in coloana auto a grilei.
Testeaza:
- test_header_contine_by_romfast: img brand-logo in .header-left (NU in header-center)
- test_titlu_centrat: titlul e in .header-center (grila 3 coloane), controale la dreapta
"""
from __future__ import annotations
import os
import re
import tempfile
import pytest
from starlette.testclient import TestClient
@pytest.fixture()
def client(monkeypatch):
tmp = tempfile.mkdtemp()
monkeypatch.setenv("AUTOPASS_DB_PATH", os.path.join(tmp, "branding.db"))
from app.config import get_settings
get_settings.cache_clear()
from app.main import app
with TestClient(app) as c:
yield c
get_settings.cache_clear()
def _get_header(html: str) -> str:
"""Extrage continutul elementului ."""
m = re.search(r"", html, re.DOTALL | re.IGNORECASE)
assert m, " negasit in HTML"
return m.group(1)
def _get_style(html: str) -> str:
"""Extrage continutul primului ", html, re.DOTALL)
assert m, "