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.
25 lines
659 B
Python
25 lines
659 B
Python
from datetime import datetime, timezone
|
|
|
|
import pytest
|
|
|
|
from core.choices import MajorChoices
|
|
from core.templatetags.jalali import fa_digits, jdate
|
|
|
|
|
|
pytestmark = pytest.mark.unit
|
|
|
|
|
|
def test_persian_digits_translate_numbers_without_changing_text():
|
|
assert fa_digits("Year 1404/09") == "Year ۱۴۰۴/۰۹"
|
|
assert fa_digits(12) == "۱۲"
|
|
|
|
|
|
def test_jalali_date_handles_missing_and_aware_values():
|
|
assert jdate(None) == ""
|
|
assert jdate(datetime(2025, 3, 21, tzinfo=timezone.utc), "%Y/%m/%d") == "1404/01/01"
|
|
|
|
|
|
def test_major_choice_public_values_are_stable():
|
|
assert MajorChoices.CE.value == "CE"
|
|
assert dict(MajorChoices.choices)["CE"]
|