import pytest

pytest.importorskip("email_validator")

from src.modules.auth.schemas import MeOut


def test_me_out_does_not_expose_password_field() -> None:
    payload = {
        "id": "user_1",
        "identificador": "user@test.com",
        "senha": "hashed-value",
        "ativo": True,
        "superadmin": False,
        "createdAt": "2025-10-02T19:38:10.336+00:00",
        "updatedAt": "2025-10-09T13:57:07.833+00:00",
    }

    model = MeOut.model_validate(payload)

    with pytest.raises(AttributeError):
        getattr(model, "senha")

    dumped = model.model_dump()
    assert "senha" not in dumped
