feat: add WonderQ admin backend
Add FastAPI admin/public API service, database setup, Docker deployment files, docs, and tests.
This commit is contained in:
9
tests/test_app.py
Normal file
9
tests/test_app.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from fastapi.testclient import TestClient
|
||||
from app.main import create_app
|
||||
|
||||
|
||||
def test_health_endpoint():
|
||||
client = TestClient(create_app())
|
||||
response = client.get("/health")
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"ok": True, "service": "miniapp-api"}
|
||||
7
tests/test_auth.py
Normal file
7
tests/test_auth.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from app.auth import hash_password, verify_password
|
||||
|
||||
|
||||
def test_bcrypt_hash_verifies_password():
|
||||
password_hash = hash_password("ChangeMe123!", rounds=4)
|
||||
assert verify_password("ChangeMe123!", password_hash)
|
||||
assert not verify_password("bad-password", password_hash)
|
||||
13
tests/test_schemas.py
Normal file
13
tests/test_schemas.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
from app.schemas import LeadCreateIn, ProductCreateIn
|
||||
|
||||
|
||||
def test_lead_phone_is_normalized():
|
||||
lead = LeadCreateIn(phone=" 187 8617 4929 ")
|
||||
assert lead.phone == "187 8617 4929"
|
||||
|
||||
|
||||
def test_product_title_requires_two_chars():
|
||||
with pytest.raises(ValidationError):
|
||||
ProductCreateIn(title="A")
|
||||
Reference in New Issue
Block a user