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:
20
apps/users/tests/integration/test_audit_command.py
Normal file
20
apps/users/tests/integration/test_audit_command.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from io import StringIO
|
||||
|
||||
import pytest
|
||||
from django.core.management import call_command
|
||||
|
||||
from apps.users.models import User
|
||||
|
||||
|
||||
pytestmark = [pytest.mark.integration, pytest.mark.django_db]
|
||||
|
||||
|
||||
def test_legacy_identity_audit_reports_placeholder_and_email_only_users(user_factory):
|
||||
first = user_factory(email="old@noemail.local")
|
||||
second = user_factory(email="person@example.com")
|
||||
User.objects.filter(pk__in=[first.pk, second.pk]).update(mobile=None)
|
||||
output = StringIO()
|
||||
call_command("audit_legacy_email_identities", stdout=output)
|
||||
report = output.getvalue()
|
||||
assert "Placeholder emails: 1" in report
|
||||
assert "Email-only users needing mobile bind: 2" in report
|
||||
Reference in New Issue
Block a user