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:
2025-09-14 21:04:07 +02:00
parent 49c813778b
commit c086f64363
48 changed files with 6992 additions and 126 deletions
+22
View File
@@ -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