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.
24 lines
794 B
Python
24 lines
794 B
Python
import pytest
|
|
|
|
from apps.events.models import Event
|
|
|
|
|
|
pytestmark = [pytest.mark.integration, pytest.mark.django_db]
|
|
|
|
|
|
def test_soft_delete_hides_record_and_restore_reveals_it(event_factory):
|
|
event = event_factory()
|
|
event.delete()
|
|
assert not Event.objects.filter(pk=event.pk).exists()
|
|
assert Event.deleted_objects.filter(pk=event.pk).exists()
|
|
assert Event.all_objects.get_queryset().dead().filter(pk=event.pk).exists()
|
|
assert not Event.all_objects.get_queryset().alive().filter(pk=event.pk).exists()
|
|
event.restore()
|
|
assert Event.objects.filter(pk=event.pk).exists()
|
|
|
|
|
|
def test_hard_delete_removes_row(event_factory):
|
|
event = event_factory()
|
|
Event.all_objects.filter(pk=event.pk).hard_delete()
|
|
assert not Event.all_objects.filter(pk=event.pk).exists()
|