PDF-Assit_RAG / backend /tests /test_password_validation.py
Param20h's picture
deploy: pure backend API with keywords fix
7c46845 unverified
Raw
History Blame Contribute Delete
915 Bytes
import pytest
from app.password_validation import validate_password
def test_validate_password_accepts_strong_password():
validate_password("Password1!")
def test_validate_password_rejects_common_password():
with pytest.raises(ValueError, match="too common"):
validate_password("password123")
def test_validate_password_rejects_short_password():
with pytest.raises(ValueError, match="8 characters"):
validate_password("Pass1!")
def test_validate_password_rejects_missing_character_classes():
with pytest.raises(ValueError, match="uppercase"):
validate_password("password1!")
with pytest.raises(ValueError, match="lowercase"):
validate_password("PASSWORD1!")
with pytest.raises(ValueError, match="number"):
validate_password("Password!")
with pytest.raises(ValueError, match="special character"):
validate_password("Password1")