Compare commits

...
Author SHA1 Message Date
stumpylog 7ed1b08220 Chore: convert test_signals.py from TestCase to pytest style
22 near-duplicate test methods. Converts to plain pytest classes to enable
pytest.mark.parametrize, which collapses those into 9 test functions covering 23 cases,
with mocker/caplog/settings fixtures replacing unittest.mock/assertLogs/override_settings.

The role-sync scenarios (superuser/staff group sync, in various combinations)
share the same setup and assertions, so they're merged into one parametrize
table.
2026-09-23 14:22:42 -07:00
2 changed files with 372 additions and 601 deletions
File diff suppressed because it is too large Load Diff
+8
View File
@@ -6,6 +6,7 @@ from __future__ import annotations
import factory
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from factory.django import DjangoModelFactory
from documents.models import Correspondent
@@ -71,6 +72,13 @@ class DocumentFactory(DjangoModelFactory[Document]):
storage_path = None
class GroupFactory(DjangoModelFactory[Group]):
class Meta:
model = Group
name = factory.Sequence(lambda n: f"group{n}")
class UserFactory(DjangoModelFactory[UserModelT]):
class Meta:
model = UserModelT