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:
2026-09-26 16:50:29 +03:30
parent 3ec28638d1
commit ff99130938
76 changed files with 3271 additions and 1357 deletions

View File

@@ -0,0 +1,9 @@
import pytest
pytestmark = [pytest.mark.integration, pytest.mark.django_db]
def test_api_routes_are_wired(client):
assert client.get("/api/health").status_code == 200
assert client.get("/api/docs").status_code == 200

View File

@@ -0,0 +1,15 @@
from types import SimpleNamespace
import pytest
from config.services.unfold import environment_callback
pytestmark = pytest.mark.unit
def test_admin_environment_badge(settings):
settings.DEBUG = True
assert environment_callback(SimpleNamespace()) == ["Development", "warning"]
settings.DEBUG = False
assert environment_callback(SimpleNamespace()) == ["Production", "success"]