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
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
rollback when replacement consumption fails.
@@ -342,8 +342,8 @@ def set_permissions(
doc_ids: list[int],
set_permissions: dict,
*,
owner=None,
merge=False,
owner: User = None,
merge: bool = False,
) -> Literal["OK"]:
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(
doc_ids: list[int],
operations: list[dict],
operations: list[dict[str, int]],
*,
delete_original: bool = False,
update_document: bool = False,

View File

@@ -1123,9 +1123,9 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.chord")
def test_edit_pdf_restore_on_failure(
self,
mock_chord,
mock_consume_file,
mock_delete_documents,
mock_chord: mock.Mock,
mock_consume_file: mock.Mock,
mock_delete_documents: mock.Mock,
) -> None:
"""
GIVEN:
@@ -1152,7 +1152,10 @@ class TestPDFActions(DirectoriesMixin, TestCase):
self.assertEqual(self.doc2.archive_serial_number, 333)
@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:
- A single existing PDF document
@@ -1182,7 +1185,11 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.group")
@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:
- Existing document
@@ -1201,7 +1208,11 @@ class TestPDFActions(DirectoriesMixin, TestCase):
@mock.patch("documents.bulk_edit.group")
@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:
- Existing document