Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

858 B
Raw Blame
import pytest

from services.account_errors import InvalidAccountPasswordError
from services.account_password_hasher import DefaultAccountPasswordHasher


def test_hash_produces_a_digest_that_can_be_verified() -> None:
    passwords = DefaultAccountPasswordHasher()

    digest = passwords.hash("password123")

    assert passwords.verify(
        "password123",
        password_hash=digest.password_hash,
        password_salt=digest.password_salt,
    )
    assert not passwords.verify(
        "different123",
        password_hash=digest.password_hash,
        password_salt=digest.password_salt,
    )


def test_hash_maps_password_policy_validation() -> None:
    passwords = DefaultAccountPasswordHasher()

    with pytest.raises(InvalidAccountPasswordError, match="Password must contain letters and numbers"):
        passwords.hash("letters-only")