From a049174e86adadd7f6df3fcfd40496f70def1098 Mon Sep 17 00:00:00 2001 From: stumpylog <797416+stumpylog@users.noreply.github.com> Date: Thu, 30 Apr 2026 15:21:40 -0700 Subject: [PATCH] Some little fixes around factories --- src/documents/tests/conftest.py | 5 +++-- src/documents/tests/test_admin.py | 2 +- src/documents/tests/test_matchables.py | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/documents/tests/conftest.py b/src/documents/tests/conftest.py index 88f0e9d76..bfe037b8e 100644 --- a/src/documents/tests/conftest.py +++ b/src/documents/tests/conftest.py @@ -12,6 +12,7 @@ from pytest_django.fixtures import SettingsWrapper from rest_framework.test import APIClient from documents.tests.factories import DocumentFactory +from documents.tests.factories import UserFactory UserModelT = get_user_model() @@ -129,9 +130,9 @@ def rest_api_client(): @pytest.fixture() -def regular_user(django_user_model: type[UserModelT]) -> UserModelT: +def regular_user(db) -> UserModelT: """Unprivileged authenticated user for permission boundary tests.""" - return django_user_model.objects.create_user(username="regular", password="regular") + return UserFactory.create() @pytest.fixture() diff --git a/src/documents/tests/test_admin.py b/src/documents/tests/test_admin.py index 22899d2ae..db48b5558 100644 --- a/src/documents/tests/test_admin.py +++ b/src/documents/tests/test_admin.py @@ -35,7 +35,7 @@ def user_admin() -> PaperlessUserAdmin: @pytest.fixture def staff_user(db) -> User: - return UserFactory.create(username="staff", staff=True) + return UserFactory.create(staff=True) class TestDocumentAdmin(DirectoriesMixin, TestCase): diff --git a/src/documents/tests/test_matchables.py b/src/documents/tests/test_matchables.py index 9ac406787..38dff2e61 100644 --- a/src/documents/tests/test_matchables.py +++ b/src/documents/tests/test_matchables.py @@ -649,7 +649,7 @@ class TestDocumentConsumptionFinishedSignal: assert doc_with_keyword.correspondent == correspondent def test_correspondent_not_applied(self, doc_with_keyword: Document) -> None: - TagFactory.create( + CorrespondentFactory.create( match="no-match", matching_algorithm=MatchingModel.MATCH_ANY, )