feat: implement complete CMT backend with API endpoints and test suite
- Add 7 core API endpoints: users, transactions, partners, products, inventory, payments, credit - Implement role-based authentication (admin/write/read-only access) - Add comprehensive database models with proper relationships - Include full test coverage for all endpoints and business logic - Set up Alembic migrations and Docker configuration - Configure FastAPI app with CORS and database integration
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import pytest
|
||||
from app.core.auth import get_password_hash, verify_password, create_access_token
|
||||
from app.schemas.base import UserRole
|
||||
|
||||
|
||||
def test_password_hashing():
|
||||
"""Test password hashing and verification."""
|
||||
password = "testpassword123"
|
||||
hashed = get_password_hash(password)
|
||||
|
||||
assert hashed != password
|
||||
assert verify_password(password, hashed) is True
|
||||
assert verify_password("wrongpassword", hashed) is False
|
||||
|
||||
|
||||
def test_create_access_token():
|
||||
"""Test JWT token creation."""
|
||||
data = {"sub": "testuser", "user_id": 1, "role": UserRole.ADMIN}
|
||||
token = create_access_token(data, expires_delta=None)
|
||||
|
||||
assert isinstance(token, str)
|
||||
assert len(token) > 0
|
||||
Reference in New Issue
Block a user