mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-09-26 19:30:31 +00:00
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.
This commit is contained in:
+364
-601
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user