test: migrate backend suites to pytest with module coverage gate
Split backend tests into unit and integration suites, add isolated fixtures and coverage enforcement, and update CI and test documentation. Cover current authentication, content, notification, payment, media, and admin flows; fix behaviors revealed by the new tests. Validate both suites and the per-module gate against local PostgreSQL.
This commit is contained in:
21
apps/payments/tests/unit/test_schemas.py
Normal file
21
apps/payments/tests/unit/test_schemas.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from apps.payments.api.schemas import CreatePaymentIn, DiscountCodeWriteSchema
|
||||
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
|
||||
def test_payment_request_requires_event_and_description():
|
||||
with pytest.raises(ValidationError):
|
||||
CreatePaymentIn(event_id=1)
|
||||
payload = CreatePaymentIn(event_id=1, description="Workshop")
|
||||
assert payload.discount_code is None
|
||||
|
||||
|
||||
def test_discount_write_defaults_to_active_percentage_code():
|
||||
payload = DiscountCodeWriteSchema(code="SAVE", value=10)
|
||||
assert payload.type == "percent"
|
||||
assert payload.is_active
|
||||
assert payload.applicable_event_ids == []
|
||||
Reference in New Issue
Block a user