mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-02-07 23:42:46 -06:00
Chore(mypy): Annotate None returns for typing improvements (#11213)
This commit is contained in:
committed by
GitHub
parent
a9c0b06e28
commit
3b5ffbf9fa
@@ -50,14 +50,14 @@ from documents.tests.utils import DocumentConsumeDelayMixin
|
||||
|
||||
|
||||
class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
def setUp(self):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
|
||||
self.user = User.objects.create_superuser(username="temp_admin")
|
||||
self.client.force_authenticate(user=self.user)
|
||||
cache.clear()
|
||||
|
||||
def testDocuments(self):
|
||||
def testDocuments(self) -> None:
|
||||
response = self.client.get("/api/documents/").data
|
||||
|
||||
self.assertEqual(response["count"], 0)
|
||||
@@ -110,7 +110,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(len(Document.objects.all()), 0)
|
||||
|
||||
def test_document_fields(self):
|
||||
def test_document_fields(self) -> None:
|
||||
c = Correspondent.objects.create(name="c", pk=41)
|
||||
dt = DocumentType.objects.create(name="dt", pk=63)
|
||||
Tag.objects.create(name="t", pk=85)
|
||||
@@ -176,7 +176,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
results = response.data["results"]
|
||||
self.assertEqual(len(results[0]), 0)
|
||||
|
||||
def test_document_fields_api_version_8_respects_created(self):
|
||||
def test_document_fields_api_version_8_respects_created(self) -> None:
|
||||
Document.objects.create(
|
||||
title="legacy",
|
||||
checksum="123",
|
||||
@@ -205,7 +205,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIn("created", results[0])
|
||||
self.assertRegex(results[0]["created"], r"^2024-01-15T00:00:00.*$")
|
||||
|
||||
def test_document_legacy_created_format(self):
|
||||
def test_document_legacy_created_format(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -258,7 +258,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
doc.refresh_from_db()
|
||||
self.assertEqual(doc.created, date(2023, 6, 28))
|
||||
|
||||
def test_document_update_legacy_created_format(self):
|
||||
def test_document_update_legacy_created_format(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -286,7 +286,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
doc.refresh_from_db()
|
||||
self.assertEqual(doc.created, date(2023, 2, 1))
|
||||
|
||||
def test_document_update_with_created_date(self):
|
||||
def test_document_update_with_created_date(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -312,7 +312,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
doc.refresh_from_db()
|
||||
self.assertEqual(doc.created_date, created_date)
|
||||
|
||||
def test_document_actions(self):
|
||||
def test_document_actions(self) -> None:
|
||||
_, filename = tempfile.mkstemp(dir=self.dirs.originals_dir)
|
||||
|
||||
content = b"This is a test"
|
||||
@@ -347,7 +347,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response.content, content_thumbnail)
|
||||
|
||||
def test_document_actions_with_perms(self):
|
||||
def test_document_actions_with_perms(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Document with owner and without granted permissions
|
||||
@@ -404,7 +404,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
@override_settings(FILENAME_FORMAT="")
|
||||
def test_download_with_archive(self):
|
||||
def test_download_with_archive(self) -> None:
|
||||
content = b"This is a test"
|
||||
content_archive = b"This is the same test but archived"
|
||||
|
||||
@@ -445,7 +445,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response.content, content)
|
||||
|
||||
def test_document_actions_not_existing_file(self):
|
||||
def test_document_actions_not_existing_file(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="none",
|
||||
filename=Path("asd").name,
|
||||
@@ -461,7 +461,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
response = self.client.get(f"/api/documents/{doc.pk}/thumb/")
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
def test_document_history_action(self):
|
||||
def test_document_history_action(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Document
|
||||
@@ -492,7 +492,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
{"title": ["First title", "New title"]},
|
||||
)
|
||||
|
||||
def test_document_history_action_w_custom_fields(self):
|
||||
def test_document_history_action_w_custom_fields(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Document with custom fields
|
||||
@@ -555,7 +555,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.data[1]["action"], "create")
|
||||
|
||||
@override_settings(AUDIT_LOG_ENABLED=False)
|
||||
def test_document_history_action_disabled(self):
|
||||
def test_document_history_action_disabled(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Audit log is disabled
|
||||
@@ -580,7 +580,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
response = self.client.get(f"/api/documents/{doc.pk}/history/")
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_document_history_insufficient_perms(self):
|
||||
def test_document_history_insufficient_perms(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Audit log is enabled
|
||||
@@ -618,7 +618,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
response = self.client.get(f"/api/documents/{doc2.pk}/history/")
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
def test_document_filters(self):
|
||||
def test_document_filters(self) -> None:
|
||||
doc1 = Document.objects.create(
|
||||
title="none1",
|
||||
checksum="A",
|
||||
@@ -793,7 +793,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
results = response.data["results"]
|
||||
self.assertEqual(len(results), 3)
|
||||
|
||||
def test_custom_field_select_filter(self):
|
||||
def test_custom_field_select_filter(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Documents with select custom field values
|
||||
@@ -828,7 +828,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(r.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(r.data["count"], 0)
|
||||
|
||||
def test_document_checksum_filter(self):
|
||||
def test_document_checksum_filter(self) -> None:
|
||||
Document.objects.create(
|
||||
title="none1",
|
||||
checksum="A",
|
||||
@@ -856,7 +856,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
results = response.data["results"]
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
def test_document_original_filename_filter(self):
|
||||
def test_document_original_filename_filter(self) -> None:
|
||||
doc1 = Document.objects.create(
|
||||
title="none1",
|
||||
checksum="A",
|
||||
@@ -896,7 +896,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
[doc1.id, doc2.id, doc3.id],
|
||||
)
|
||||
|
||||
def test_documents_title_content_filter(self):
|
||||
def test_documents_title_content_filter(self) -> None:
|
||||
doc1 = Document.objects.create(
|
||||
title="title A",
|
||||
content="content A",
|
||||
@@ -945,7 +945,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
results = response.data["results"]
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
def test_documents_title_content_filter_strips_boundary_whitespace(self):
|
||||
def test_documents_title_content_filter_strips_boundary_whitespace(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="Testwort",
|
||||
content="",
|
||||
@@ -962,7 +962,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(len(results), 1)
|
||||
self.assertEqual(results[0]["id"], doc.id)
|
||||
|
||||
def test_document_permissions_filters(self):
|
||||
def test_document_permissions_filters(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Documents with owners, with and without granted permissions
|
||||
@@ -1066,7 +1066,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
[u1_doc1.id],
|
||||
)
|
||||
|
||||
def test_pagination_all(self):
|
||||
def test_pagination_all(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- A set of 50 documents
|
||||
@@ -1091,7 +1091,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(len(response.data["all"]), 50)
|
||||
self.assertCountEqual(response.data["all"], [d.id for d in docs])
|
||||
|
||||
def test_statistics(self):
|
||||
def test_statistics(self) -> None:
|
||||
doc1 = Document.objects.create(
|
||||
title="none1",
|
||||
checksum="A",
|
||||
@@ -1141,7 +1141,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.data["document_type_count"], 1)
|
||||
self.assertEqual(response.data["storage_path_count"], 2)
|
||||
|
||||
def test_statistics_no_inbox_tag(self):
|
||||
def test_statistics_no_inbox_tag(self) -> None:
|
||||
Document.objects.create(title="none1", checksum="A")
|
||||
|
||||
response = self.client.get("/api/statistics/")
|
||||
@@ -1149,7 +1149,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.data["documents_inbox"], None)
|
||||
self.assertEqual(response.data["inbox_tags"], None)
|
||||
|
||||
def test_statistics_multiple_users(self):
|
||||
def test_statistics_multiple_users(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Inbox tags with different owners and documents that are accessible to different users
|
||||
@@ -1188,7 +1188,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(response.data["documents_inbox"], 0)
|
||||
|
||||
def test_upload(self):
|
||||
def test_upload(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1212,7 +1212,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.document_type_id)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_create_wrong_endpoint(self):
|
||||
def test_create_wrong_endpoint(self) -> None:
|
||||
response = self.client.post(
|
||||
"/api/documents/",
|
||||
{},
|
||||
@@ -1220,7 +1220,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_405_METHOD_NOT_ALLOWED)
|
||||
|
||||
def test_upload_insufficient_permissions(self):
|
||||
def test_upload_insufficient_permissions(self) -> None:
|
||||
self.client.force_authenticate(user=User.objects.create_user("testuser2"))
|
||||
|
||||
with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f:
|
||||
@@ -1231,7 +1231,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
def test_upload_empty_metadata(self):
|
||||
def test_upload_empty_metadata(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1262,7 +1262,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.storage_path_id)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_invalid_form(self):
|
||||
def test_upload_invalid_form(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1275,7 +1275,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_invalid_file(self):
|
||||
def test_upload_invalid_file(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1288,7 +1288,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_with_title(self):
|
||||
def test_upload_with_title(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1309,7 +1309,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.document_type_id)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_with_correspondent(self):
|
||||
def test_upload_with_correspondent(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1331,7 +1331,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.document_type_id)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_with_invalid_correspondent(self):
|
||||
def test_upload_with_invalid_correspondent(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1345,7 +1345,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_with_document_type(self):
|
||||
def test_upload_with_document_type(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1367,7 +1367,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.title)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_with_invalid_document_type(self):
|
||||
def test_upload_with_invalid_document_type(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1381,7 +1381,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_with_storage_path(self):
|
||||
def test_upload_with_storage_path(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1403,7 +1403,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.title)
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
|
||||
def test_upload_with_invalid_storage_path(self):
|
||||
def test_upload_with_invalid_storage_path(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1417,7 +1417,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_with_tags(self):
|
||||
def test_upload_with_tags(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1440,7 +1440,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.correspondent_id)
|
||||
self.assertIsNone(overrides.title)
|
||||
|
||||
def test_upload_with_invalid_tags(self):
|
||||
def test_upload_with_invalid_tags(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1456,7 +1456,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_upload_with_created(self):
|
||||
def test_upload_with_created(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1484,7 +1484,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(overrides.created, created.date())
|
||||
|
||||
def test_upload_with_asn(self):
|
||||
def test_upload_with_asn(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1508,7 +1508,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(overrides.tag_ids)
|
||||
self.assertEqual(500, overrides.asn)
|
||||
|
||||
def test_upload_with_custom_fields(self):
|
||||
def test_upload_with_custom_fields(self) -> None:
|
||||
self.consume_file_mock.return_value = celery.result.AsyncResult(
|
||||
id=str(uuid.uuid4()),
|
||||
)
|
||||
@@ -1537,7 +1537,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(overrides.filename, "simple.pdf")
|
||||
self.assertEqual(overrides.custom_fields, {custom_field.id: None})
|
||||
|
||||
def test_upload_with_custom_fields_and_workflow(self):
|
||||
def test_upload_with_custom_fields_and_workflow(self) -> None:
|
||||
"""
|
||||
GIVEN: A document with a source file
|
||||
WHEN: Upload the document with custom fields and a workflow
|
||||
@@ -1599,7 +1599,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
overrides.update(new_overrides)
|
||||
self.assertEqual(overrides.custom_fields, {cf.id: None, cf2.id: 123})
|
||||
|
||||
def test_upload_with_custom_field_values(self):
|
||||
def test_upload_with_custom_field_values(self) -> None:
|
||||
"""
|
||||
GIVEN: A document with a source file
|
||||
WHEN: Upload the document with custom fields and values
|
||||
@@ -1645,7 +1645,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
{cf_string.id: "a string", cf_int.id: 123},
|
||||
)
|
||||
|
||||
def test_upload_with_custom_fields_errors(self):
|
||||
def test_upload_with_custom_fields_errors(self) -> None:
|
||||
"""
|
||||
GIVEN: A document with a source file
|
||||
WHEN: Upload the document with invalid custom fields payloads
|
||||
@@ -1679,7 +1679,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.consume_file_mock.assert_not_called()
|
||||
|
||||
def test_patch_document_integer_custom_field_out_of_range(self):
|
||||
def test_patch_document_integer_custom_field_out_of_range(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- An integer custom field
|
||||
@@ -1717,7 +1717,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIn("custom_fields", response.data)
|
||||
self.assertEqual(CustomFieldInstance.objects.count(), 0)
|
||||
|
||||
def test_upload_with_webui_source(self):
|
||||
def test_upload_with_webui_source(self) -> None:
|
||||
"""
|
||||
GIVEN: A document with a source file
|
||||
WHEN: Upload the document with 'from_webui' flag
|
||||
@@ -1741,7 +1741,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(input_doc.source, WorkflowTrigger.DocumentSourceChoices.WEB_UI)
|
||||
|
||||
def test_upload_invalid_pdf(self):
|
||||
def test_upload_invalid_pdf(self) -> None:
|
||||
"""
|
||||
GIVEN: Invalid PDF named "*.pdf" that mime_type is in settings.CONSUMER_PDF_RECOVERABLE_MIME_TYPES
|
||||
WHEN: Upload the file
|
||||
@@ -1759,7 +1759,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
def test_get_metadata(self):
|
||||
def test_get_metadata(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="test",
|
||||
filename="file.pdf",
|
||||
@@ -1797,11 +1797,11 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
response = self.client.get(f"/api/documents/{doc.pk}/metadata/")
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
|
||||
def test_get_metadata_invalid_doc(self):
|
||||
def test_get_metadata_invalid_doc(self) -> None:
|
||||
response = self.client.get("/api/documents/34576/metadata/")
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
def test_get_metadata_no_archive(self):
|
||||
def test_get_metadata_no_archive(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="test",
|
||||
filename="file.pdf",
|
||||
@@ -1821,7 +1821,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(meta["archive_metadata"])
|
||||
self.assertIsNone(meta["archive_media_filename"])
|
||||
|
||||
def test_get_metadata_missing_files(self):
|
||||
def test_get_metadata_missing_files(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="test",
|
||||
filename="file.pdf",
|
||||
@@ -1842,7 +1842,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertIsNone(meta["archive_metadata"])
|
||||
self.assertIsNone(meta["archive_size"])
|
||||
|
||||
def test_get_empty_suggestions(self):
|
||||
def test_get_empty_suggestions(self) -> None:
|
||||
doc = Document.objects.create(title="test", mime_type="application/pdf")
|
||||
|
||||
response = self.client.get(f"/api/documents/{doc.pk}/suggestions/")
|
||||
@@ -1859,7 +1859,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
},
|
||||
)
|
||||
|
||||
def test_get_suggestions_invalid_doc(self):
|
||||
def test_get_suggestions_invalid_doc(self) -> None:
|
||||
response = self.client.get("/api/documents/34676/suggestions/")
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
@@ -2012,7 +2012,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.client.get(f"/api/documents/{doc.pk}/suggestions/")
|
||||
self.assertFalse(parse_date_generator.called)
|
||||
|
||||
def test_saved_views(self):
|
||||
def test_saved_views(self) -> None:
|
||||
u1 = User.objects.create_superuser("user1")
|
||||
u2 = User.objects.create_superuser("user2")
|
||||
|
||||
@@ -2069,7 +2069,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
status.HTTP_404_NOT_FOUND,
|
||||
)
|
||||
|
||||
def test_saved_view_create_update_patch(self):
|
||||
def test_saved_view_create_update_patch(self) -> None:
|
||||
User.objects.create_user("user1")
|
||||
|
||||
view = {
|
||||
@@ -2116,7 +2116,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
v1 = SavedView.objects.get(id=v1.id)
|
||||
self.assertEqual(v1.filter_rules.count(), 0)
|
||||
|
||||
def test_saved_view_display_options(self):
|
||||
def test_saved_view_display_options(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Saved view
|
||||
@@ -2207,7 +2207,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
v1.refresh_from_db()
|
||||
self.assertEqual(v1.display_fields, None)
|
||||
|
||||
def test_saved_view_display_customfields(self):
|
||||
def test_saved_view_display_customfields(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Saved view
|
||||
@@ -2278,7 +2278,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_saved_view_cleanup_after_custom_field_deletion(self):
|
||||
def test_saved_view_cleanup_after_custom_field_deletion(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Saved view with custom field in display fields and as sort field
|
||||
@@ -2314,7 +2314,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
[str(SavedView.DisplayFields.TITLE), str(SavedView.DisplayFields.CREATED)],
|
||||
)
|
||||
|
||||
def test_get_logs(self):
|
||||
def test_get_logs(self) -> None:
|
||||
log_data = "test\ntest2\n"
|
||||
with (Path(settings.LOGGING_DIR) / "mail.log").open("w") as f:
|
||||
f.write(log_data)
|
||||
@@ -2324,7 +2324,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertCountEqual(response.data, ["mail", "paperless"])
|
||||
|
||||
def test_get_logs_only_when_exist(self):
|
||||
def test_get_logs_only_when_exist(self) -> None:
|
||||
log_data = "test\ntest2\n"
|
||||
with (Path(settings.LOGGING_DIR) / "paperless.log").open("w") as f:
|
||||
f.write(log_data)
|
||||
@@ -2332,16 +2332,16 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertCountEqual(response.data, ["paperless"])
|
||||
|
||||
def test_get_invalid_log(self):
|
||||
def test_get_invalid_log(self) -> None:
|
||||
response = self.client.get("/api/logs/bogus_log/")
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
@override_settings(LOGGING_DIR="bogus_dir")
|
||||
def test_get_nonexistent_log(self):
|
||||
def test_get_nonexistent_log(self) -> None:
|
||||
response = self.client.get("/api/logs/paperless/")
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
def test_get_log(self):
|
||||
def test_get_log(self) -> None:
|
||||
log_data = "test\ntest2\n"
|
||||
with (Path(settings.LOGGING_DIR) / "paperless.log").open("w") as f:
|
||||
f.write(log_data)
|
||||
@@ -2349,7 +2349,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertListEqual(response.data, ["test", "test2"])
|
||||
|
||||
def test_get_log_with_limit(self):
|
||||
def test_get_log_with_limit(self) -> None:
|
||||
log_data = "test1\ntest2\ntest3\n"
|
||||
with (Path(settings.LOGGING_DIR) / "paperless.log").open("w") as f:
|
||||
f.write(log_data)
|
||||
@@ -2357,7 +2357,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
self.assertListEqual(response.data, ["test2", "test3"])
|
||||
|
||||
def test_get_log_with_invalid_limit(self):
|
||||
def test_get_log_with_invalid_limit(self) -> None:
|
||||
log_data = "test1\ntest2\n"
|
||||
with (Path(settings.LOGGING_DIR) / "paperless.log").open("w") as f:
|
||||
f.write(log_data)
|
||||
@@ -2366,7 +2366,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
response = self.client.get("/api/logs/paperless/", {"limit": -5})
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_invalid_regex_other_algorithm(self):
|
||||
def test_invalid_regex_other_algorithm(self) -> None:
|
||||
for endpoint in ["correspondents", "tags", "document_types"]:
|
||||
response = self.client.post(
|
||||
f"/api/{endpoint}/",
|
||||
@@ -2379,7 +2379,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED, endpoint)
|
||||
|
||||
def test_invalid_regex(self):
|
||||
def test_invalid_regex(self) -> None:
|
||||
for endpoint in ["correspondents", "tags", "document_types"]:
|
||||
response = self.client.post(
|
||||
f"/api/{endpoint}/",
|
||||
@@ -2396,7 +2396,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
endpoint,
|
||||
)
|
||||
|
||||
def test_valid_regex(self):
|
||||
def test_valid_regex(self) -> None:
|
||||
for endpoint in ["correspondents", "tags", "document_types"]:
|
||||
response = self.client.post(
|
||||
f"/api/{endpoint}/",
|
||||
@@ -2409,7 +2409,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED, endpoint)
|
||||
|
||||
def test_regex_no_algorithm(self):
|
||||
def test_regex_no_algorithm(self) -> None:
|
||||
for endpoint in ["correspondents", "tags", "document_types"]:
|
||||
response = self.client.post(
|
||||
f"/api/{endpoint}/",
|
||||
@@ -2418,7 +2418,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED, endpoint)
|
||||
|
||||
def test_tag_color_default(self):
|
||||
def test_tag_color_default(self) -> None:
|
||||
response = self.client.post("/api/tags/", {"name": "tag"}, format="json")
|
||||
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
|
||||
self.assertEqual(Tag.objects.get(id=response.data["id"]).color, "#a6cee3")
|
||||
@@ -2431,7 +2431,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
1,
|
||||
)
|
||||
|
||||
def test_tag_color(self):
|
||||
def test_tag_color(self) -> None:
|
||||
response = self.client.post(
|
||||
"/api/tags/",
|
||||
data={"name": "tag", "colour": 3},
|
||||
@@ -2449,7 +2449,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
3,
|
||||
)
|
||||
|
||||
def test_tag_color_invalid(self):
|
||||
def test_tag_color_invalid(self) -> None:
|
||||
response = self.client.post(
|
||||
"/api/tags/",
|
||||
data={"name": "tag", "colour": 34},
|
||||
@@ -2458,7 +2458,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_tag_color_custom(self):
|
||||
def test_tag_color_custom(self) -> None:
|
||||
tag = Tag.objects.create(name="test", color="#abcdef")
|
||||
self.assertEqual(
|
||||
self.client.get(
|
||||
@@ -2469,7 +2469,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
1,
|
||||
)
|
||||
|
||||
def test_get_existing_notes(self):
|
||||
def test_get_existing_notes(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- A document with a single note
|
||||
@@ -2531,7 +2531,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
},
|
||||
)
|
||||
|
||||
def test_docnote_serializer_v7(self):
|
||||
def test_docnote_serializer_v7(self) -> None:
|
||||
doc = Document.objects.create(
|
||||
title="test",
|
||||
mime_type="application/pdf",
|
||||
@@ -2551,7 +2551,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.user.id,
|
||||
)
|
||||
|
||||
def test_create_note(self):
|
||||
def test_create_note(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -2595,7 +2595,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
# modified was updated to today
|
||||
self.assertEqual(doc.modified.day, timezone.now().day)
|
||||
|
||||
def test_notes_permissions_aware(self):
|
||||
def test_notes_permissions_aware(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document owned by user2 but with granted view perms for user1
|
||||
@@ -2651,7 +2651,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(response.content, b"Insufficient permissions to delete notes")
|
||||
self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)
|
||||
|
||||
def test_delete_note(self):
|
||||
def test_delete_note(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document, existing note
|
||||
@@ -2687,7 +2687,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
# modified was updated to today
|
||||
self.assertEqual(doc.modified.day, timezone.now().day)
|
||||
|
||||
def test_get_notes_no_doc(self):
|
||||
def test_get_notes_no_doc(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- A request to get notes from a non-existent document
|
||||
@@ -2702,7 +2702,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
def test_tag_unique_name_and_owner(self):
|
||||
def test_tag_unique_name_and_owner(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Multiple users
|
||||
@@ -2762,7 +2762,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_tag_unique_name_and_owner_enforced_on_update(self):
|
||||
def test_tag_unique_name_and_owner_enforced_on_update(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Multiple users
|
||||
@@ -2796,7 +2796,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_create_share_links(self):
|
||||
def test_create_share_links(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -2868,7 +2868,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
|
||||
|
||||
def test_share_links_permissions_aware(self):
|
||||
def test_share_links_permissions_aware(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document owned by user2 but with granted view perms for user1
|
||||
@@ -2909,7 +2909,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
||||
|
||||
def test_next_asn(self):
|
||||
def test_next_asn(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing documents with ASNs, highest owned by user2
|
||||
@@ -2953,7 +2953,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(resp.content, b"1000")
|
||||
|
||||
def test_next_asn_no_documents_with_asn(self):
|
||||
def test_next_asn_no_documents_with_asn(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document, but with no ASN assugned
|
||||
@@ -2982,7 +2982,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(resp.status_code, status.HTTP_200_OK)
|
||||
self.assertEqual(resp.content, b"1")
|
||||
|
||||
def test_asn_not_unique_with_trashed_doc(self):
|
||||
def test_asn_not_unique_with_trashed_doc(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document with ASN that is trashed
|
||||
@@ -3026,7 +3026,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
},
|
||||
)
|
||||
|
||||
def test_remove_inbox_tags(self):
|
||||
def test_remove_inbox_tags(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document with or without inbox tags
|
||||
@@ -3096,7 +3096,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
EMAIL_ENABLED=True,
|
||||
EMAIL_BACKEND="django.core.mail.backends.locmem.EmailBackend",
|
||||
)
|
||||
def test_email_document(self):
|
||||
def test_email_document(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -3156,7 +3156,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(mail.outbox[1].attachments[0][0], expected_filename2)
|
||||
|
||||
@mock.patch("django.core.mail.message.EmailMessage.send", side_effect=Exception)
|
||||
def test_email_document_errors(self, mocked_send):
|
||||
def test_email_document_errors(self, mocked_send) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document
|
||||
@@ -3242,7 +3242,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
self.assertEqual(resp.status_code, status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
||||
@mock.patch("django_softdelete.models.SoftDeleteModel.delete")
|
||||
def test_warn_on_delete_with_old_uuid_field(self, mocked_delete):
|
||||
def test_warn_on_delete_with_old_uuid_field(self, mocked_delete) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Existing document in a (mocked) MariaDB database with an old UUID field
|
||||
@@ -3272,7 +3272,7 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
||||
|
||||
|
||||
class TestDocumentApiV2(DirectoriesMixin, APITestCase):
|
||||
def setUp(self):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
|
||||
self.user = User.objects.create_superuser(username="temp_admin")
|
||||
@@ -3280,7 +3280,7 @@ class TestDocumentApiV2(DirectoriesMixin, APITestCase):
|
||||
self.client.force_authenticate(user=self.user)
|
||||
self.client.defaults["HTTP_ACCEPT"] = "application/json; version=2"
|
||||
|
||||
def test_tag_validate_color(self):
|
||||
def test_tag_validate_color(self) -> None:
|
||||
self.assertEqual(
|
||||
self.client.post(
|
||||
"/api/tags/",
|
||||
@@ -3323,7 +3323,7 @@ class TestDocumentApiV2(DirectoriesMixin, APITestCase):
|
||||
status.HTTP_400_BAD_REQUEST,
|
||||
)
|
||||
|
||||
def test_tag_text_color(self):
|
||||
def test_tag_text_color(self) -> None:
|
||||
t = Tag.objects.create(name="tag1", color="#000000")
|
||||
self.assertEqual(
|
||||
self.client.get(f"/api/tags/{t.id}/", format="json").data["text_color"],
|
||||
@@ -3353,7 +3353,7 @@ class TestDocumentApiV2(DirectoriesMixin, APITestCase):
|
||||
|
||||
|
||||
class TestDocumentApiCustomFieldsSorting(DirectoriesMixin, APITestCase):
|
||||
def setUp(self):
|
||||
def setUp(self) -> None:
|
||||
super().setUp()
|
||||
|
||||
self.user = User.objects.create_superuser(username="temp_admin")
|
||||
@@ -3377,7 +3377,7 @@ class TestDocumentApiCustomFieldsSorting(DirectoriesMixin, APITestCase):
|
||||
|
||||
cache.clear()
|
||||
|
||||
def test_document_custom_fields_sorting(self):
|
||||
def test_document_custom_fields_sorting(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Documents with custom fields
|
||||
@@ -3497,7 +3497,7 @@ class TestDocumentApiCustomFieldsSorting(DirectoriesMixin, APITestCase):
|
||||
[self.doc1.id, self.doc3.id, self.doc2.id],
|
||||
)
|
||||
|
||||
def test_document_custom_fields_sorting_invalid(self):
|
||||
def test_document_custom_fields_sorting_invalid(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Documents with custom fields
|
||||
@@ -3512,7 +3512,7 @@ class TestDocumentApiCustomFieldsSorting(DirectoriesMixin, APITestCase):
|
||||
)
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
def test_document_custom_fields_sorting_invalid_data_type(self):
|
||||
def test_document_custom_fields_sorting_invalid_data_type(self) -> None:
|
||||
"""
|
||||
GIVEN:
|
||||
- Documents with custom fields
|
||||
|
||||
Reference in New Issue
Block a user