r we having fun yet

This commit is contained in:
shamoon
2026-02-05 00:07:45 -08:00
parent 1b448a3a78
commit 2559717dcd
2 changed files with 21 additions and 10 deletions

View File

@@ -63,7 +63,7 @@ def release_archive_serial_numbers(doc_ids: list[int]) -> dict[int, int | None]:
return backup return backup
def restore_archive_serial_numbers(backup: dict[int, int]) -> None: def restore_archive_serial_numbers(backup: dict[int, int | None]) -> None:
""" """
Restores ASNs using the provided backup map, intended for Restores ASNs using the provided backup map, intended for
rollback when replacement consumption fails. rollback when replacement consumption fails.
@@ -342,8 +342,8 @@ def set_permissions(
doc_ids: list[int], doc_ids: list[int],
set_permissions: dict, set_permissions: dict,
*, *,
owner=None, owner: User = None,
merge=False, merge: bool = False,
) -> Literal["OK"]: ) -> Literal["OK"]:
qs = Document.objects.filter(id__in=doc_ids).select_related("owner") qs = Document.objects.filter(id__in=doc_ids).select_related("owner")
@@ -614,7 +614,7 @@ def delete_pages(doc_ids: list[int], pages: list[int]) -> Literal["OK"]:
def edit_pdf( def edit_pdf(
doc_ids: list[int], doc_ids: list[int],
operations: list[dict], operations: list[dict[str, int]],
*, *,
delete_original: bool = False, delete_original: bool = False,
update_document: bool = False, update_document: bool = False,

View File

@@ -1123,9 +1123,9 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.chord") @mock.patch("documents.bulk_edit.chord")
def test_edit_pdf_restore_on_failure( def test_edit_pdf_restore_on_failure(
self, self,
mock_chord, mock_chord: mock.Mock,
mock_consume_file, mock_consume_file: mock.Mock,
mock_delete_documents, mock_delete_documents: mock.Mock,
) -> None: ) -> None:
""" """
GIVEN: GIVEN:
@@ -1152,7 +1152,10 @@ class TestPDFActions(DirectoriesMixin, TestCase):
self.assertEqual(self.doc2.archive_serial_number, 333) self.assertEqual(self.doc2.archive_serial_number, 333)
@mock.patch("documents.tasks.update_document_content_maybe_archive_file.delay") @mock.patch("documents.tasks.update_document_content_maybe_archive_file.delay")
def test_edit_pdf_with_update_document(self, mock_update_document) -> None: def test_edit_pdf_with_update_document(
self,
mock_update_document: mock.Mock,
) -> None:
""" """
GIVEN: GIVEN:
- A single existing PDF document - A single existing PDF document
@@ -1182,7 +1185,11 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.group") @mock.patch("documents.bulk_edit.group")
@mock.patch("documents.tasks.consume_file.s") @mock.patch("documents.tasks.consume_file.s")
def test_edit_pdf_without_metadata(self, mock_consume_file, mock_group) -> None: def test_edit_pdf_without_metadata(
self,
mock_consume_file: mock.Mock,
mock_group: mock.Mock,
) -> None:
""" """
GIVEN: GIVEN:
- Existing document - Existing document
@@ -1201,7 +1208,11 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.group") @mock.patch("documents.bulk_edit.group")
@mock.patch("documents.tasks.consume_file.s") @mock.patch("documents.tasks.consume_file.s")
def test_edit_pdf_open_failure(self, mock_consume_file, mock_group) -> None: def test_edit_pdf_open_failure(
self,
mock_consume_file: mock.Mock,
mock_group: mock.Mock,
) -> None:
""" """
GIVEN: GIVEN:
- Existing document - Existing document