From 92be98df8941561c56e2008e8318ba20a52aa402 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:23:47 -0700 Subject: [PATCH] Chore: Use the shared simple-digital.pdf in documents tests and drop the unreferenced simple.txt Co-Authored-By: Claude Sonnet 5.5 --- src/documents/tests/samples/simple.pdf | Bin 22926 -> 0 bytes src/documents/tests/samples/simple.txt | 1 - src/documents/tests/test_api_bulk_download.py | 2 +- src/documents/tests/test_api_documents.py | 73 +++++++++++------- src/documents/tests/test_api_email.py | 4 +- src/documents/tests/test_barcodes.py | 4 +- src/documents/tests/test_consumer.py | 3 +- src/documents/tests/test_double_sided.py | 7 +- src/documents/tests/test_management.py | 3 +- .../tests/test_management_thumbnails.py | 5 +- src/documents/tests/test_workflows.py | 54 ++++++------- src/documents/tests/utils.py | 3 + 12 files changed, 94 insertions(+), 65 deletions(-) delete mode 100644 src/documents/tests/samples/simple.pdf delete mode 100644 src/documents/tests/samples/simple.txt diff --git a/src/documents/tests/samples/simple.pdf b/src/documents/tests/samples/simple.pdf deleted file mode 100644 index e450de48269ce43785b8344c63e233a1794abae6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22926 zcmeFZ1ymeg@;^!l!6mrE;Lb3(yL)iAVQ_bM2@U~*y9EgZNJ4OTf?IHc27(3mH{|=> z-S7V7z4P{+J?EYO***+?`*z*Bb*rj-daCNvG^&!)EFe~HWSZ{c?w0P)-Fe9D05*W5 znGLd_AW#wFVCiNB;DGk10i~_&+#oJMX**Llh$IB;Xbuq;Ms{^`ftcDOdu6l44>H?6H;@?p^vKWPs#P#ZGbM{;Bcf{BGr+ELKNlvYYRNcNgtX+7@aLXT zMQN!S?3XnMOGXzd6?Y;rsx^sOB+DXSS48V9%8C_*Nre0Ge09*fJ;tB)nym>uKSOw1 z2i!o0IGFz_FtqiwM&zfZJvBhw+)rnJ_woEU1@Qha3iwk&AOMJsm!0je>e%A*b|c=( zS#^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_E9&fT z5yrov&i(+8N!dZ{p|DCQl+4t@+|S$s1FAXNL6l5?1K<8!22d3WB>i*pzc-$=0aVccy}W;(^f#kFCslU0chyH`1Ly<( zCY|A50;B&mBKw5hb4C7dfIVd3-w}Jz$m-uAd(c^d3fAVX`hRHl=}^Ma{Rueumnqo) zE2vTe8h5pGw1lo4I@ccvL1dtc6U0Fb{1oif|7|4zP)An};NWg&_s2grDDQt(-QO*s zXzE}|4{>18RA+$7Y3gDt2MtU@-QuYUG5-@D2%X_C!Dd(e-?3;lL+HBx2m}K_zj3#J zmHRJn$v;DSg3?mb(rj#8JZ#V^CpI>2KIonkx`)CtdDx-G_*)?IPdZMCKWMn2w7==0 zbez!f+}wYDpyRnYpdV;Il!T1~%9mXVx@Uv(`aLC79Z#V_dP!(Fkev+#0`Y>l*x7!^ z1?kw>=otPYu9pkM0%~S<4rC~&KQ{n37Z(Q?zyk1R9}gD?)ZkAWz~TQY+=_7iIzwS=we$U&?!S+P!s`D6h(o=UGn;zf@Ux^bR~{QiN51tfzOz8%?u_+(c;KQ zhSD}T@LJ)eXGF>TK0gtN`{OwrawtjqNr zu=Ty=!&Y~Iu{Jf(7qWchg&`<|%RL{t1SLLk>*XB}8ke?Pd;Gj%M2wgYKkM)?7506b z)Cc-o(|s#&`Rh0lg~C4S#JPxi2#hpVu65C6obhw`Ur2K@=FM_GeSBSizlWDuDCw-V kPGfa=d?`gW`dlS1xI->&7F}1o7(8T1_&&7T@9RN#cXxA{fdBvi diff --git a/src/documents/tests/samples/simple.txt b/src/documents/tests/samples/simple.txt deleted file mode 100644 index 6de7b8c69..000000000 --- a/src/documents/tests/samples/simple.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test file. diff --git a/src/documents/tests/test_api_bulk_download.py b/src/documents/tests/test_api_bulk_download.py index b031a5105..0f8dc7afe 100644 --- a/src/documents/tests/test_api_bulk_download.py +++ b/src/documents/tests/test_api_bulk_download.py @@ -53,7 +53,7 @@ class TestBulkDownload(DirectoriesMixin, SampleDirMixin, APITestCase): archive_checksum="D", ) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", self.doc2.source_path) + shutil.copy(self.SIMPLE_PDF, self.doc2.source_path) shutil.copy(self.SAMPLE_DIR / "simple.png", self.doc2b.source_path) shutil.copy(self.SAMPLE_DIR / "simple.jpg", self.doc3.source_path) shutil.copy(self.SAMPLE_DIR / "test_with_bom.pdf", self.doc3.archive_path) diff --git a/src/documents/tests/test_api_documents.py b/src/documents/tests/test_api_documents.py index defba88d3..1ecf0a8b9 100644 --- a/src/documents/tests/test_api_documents.py +++ b/src/documents/tests/test_api_documents.py @@ -56,6 +56,7 @@ from paperless_testing.http import read_streaming_response from paperless_testing.permissions import grant_all_global from paperless_testing.permissions import grant_global from paperless_testing.permissions import grant_object +from paperless_testing.samples import SIMPLE_DIGITAL_PDF class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): @@ -1852,7 +1853,11 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with SimpleUploadedFile( + "simple.pdf", + SIMPLE_DIGITAL_PDF.read_bytes(), + content_type="application/pdf", + ) as f: response = self.client.post( "/api/documents/post_document/", {"document": f}, @@ -1880,7 +1885,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): payload = SimpleUploadedFile( "../../outside.pdf", - (Path(__file__).parent / "samples" / "simple.pdf").read_bytes(), + (SIMPLE_DIGITAL_PDF).read_bytes(), content_type="application/pdf", ) @@ -1909,7 +1914,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - pdf_bytes = (Path(__file__).parent / "samples" / "simple.pdf").read_bytes() + pdf_bytes = (SIMPLE_DIGITAL_PDF).read_bytes() boundary = "paperless-boundary" payload = ( ( @@ -1985,7 +1990,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): def test_upload_insufficient_permissions(self) -> None: self.client.force_authenticate(user=UserFactory(username="testuser2")) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f}, @@ -1998,7 +2003,11 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with SimpleUploadedFile( + "simple.pdf", + SIMPLE_DIGITAL_PDF.read_bytes(), + content_type="application/pdf", + ) as f: response = self.client.post( "/api/documents/post_document/", { @@ -2031,7 +2040,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"documenst": f}, @@ -2057,7 +2066,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "title": "my custom title"}, @@ -2077,7 +2086,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): ) c = Correspondent.objects.create(name="test-corres") - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "correspondent": c.id}, @@ -2096,7 +2105,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "correspondent": 3456}, @@ -2111,7 +2120,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): ) dt = DocumentType.objects.create(name="invoice") - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "document_type": dt.id}, @@ -2130,7 +2139,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "document_type": 34578}, @@ -2145,7 +2154,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): ) sp = StoragePath.objects.create(name="invoices") - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "storage_path": sp.id}, @@ -2164,7 +2173,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "storage_path": 34578}, @@ -2180,7 +2189,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): t1 = Tag.objects.create(name="tag1") t2 = Tag.objects.create(name="tag2") - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "tags": [t2.id, t1.id]}, @@ -2201,7 +2210,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): t1 = Tag.objects.create(name="tag1") t2 = Tag.objects.create(name="tag2") - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "tags": [t2.id, t1.id, 734563]}, @@ -2225,7 +2234,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): 0, tzinfo=zoneinfo.ZoneInfo("America/Los_Angeles"), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "created": created}, @@ -2241,7 +2250,11 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with SimpleUploadedFile( + "simple.pdf", + SIMPLE_DIGITAL_PDF.read_bytes(), + content_type="application/pdf", + ) as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "archive_serial_number": 500}, @@ -2268,7 +2281,11 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): data_type=CustomField.FieldDataType.STRING, ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with SimpleUploadedFile( + "simple.pdf", + SIMPLE_DIGITAL_PDF.read_bytes(), + content_type="application/pdf", + ) as f: response = self.client.post( "/api/documents/post_document/", { @@ -2323,7 +2340,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): w1.actions.add(action1) w1.save() - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", { @@ -2364,7 +2381,11 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): data_type=CustomField.FieldDataType.INT, ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with SimpleUploadedFile( + "simple.pdf", + SIMPLE_DIGITAL_PDF.read_bytes(), + content_type="application/pdf", + ) as f: response = self.client.post( "/api/documents/post_document/", { @@ -2413,7 +2434,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): ] for payload in error_payloads: - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: data = {"document": f, **payload} response = self.client.post( "/api/documents/post_document/", @@ -2471,7 +2492,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): id=str(uuid.uuid4()), ) - with (Path(__file__).parent / "samples" / "simple.pdf").open("rb") as f: + with (SIMPLE_DIGITAL_PDF).open("rb") as f: response = self.client.post( "/api/documents/post_document/", {"document": f, "from_webui": True}, @@ -2517,7 +2538,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): / "thumbnails" / "0000001.webp" ) - archive_file: Path = Path(__file__).parent / "samples" / "simple.pdf" + archive_file: Path = SIMPLE_DIGITAL_PDF shutil.copy(source_file, doc.source_path) shutil.copy(archive_file, doc.archive_path) @@ -2550,7 +2571,7 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): mime_type="application/pdf", ) - shutil.copy(Path(__file__).parent / "samples" / "simple.pdf", doc.source_path) + shutil.copy(SIMPLE_DIGITAL_PDF, doc.source_path) response = self.client.get(f"/api/documents/{doc.pk}/metadata/") self.assertEqual(response.status_code, status.HTTP_200_OK) @@ -4288,8 +4309,8 @@ class TestDocumentApi(DirectoriesMixin, ConsumeTaskMixin, APITestCase): filename="test2.pdf", ) - archive_file = Path(__file__).parent / "samples" / "simple.pdf" - source_file = Path(__file__).parent / "samples" / "simple.pdf" + archive_file = SIMPLE_DIGITAL_PDF + source_file = SIMPLE_DIGITAL_PDF shutil.copy(archive_file, doc.archive_path) shutil.copy(source_file, doc2.source_path) diff --git a/src/documents/tests/test_api_email.py b/src/documents/tests/test_api_email.py index d26f26d85..0d2dbbbde 100644 --- a/src/documents/tests/test_api_email.py +++ b/src/documents/tests/test_api_email.py @@ -377,7 +377,7 @@ class TestEmail(DirectoriesMixin, SampleDirMixin, APITestCase): checksum="3", filename="test3.pdf", ) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", doc3.source_path) + shutil.copy(self.SIMPLE_PDF, doc3.source_path) doc4 = Document.objects.create( title="test1", @@ -386,7 +386,7 @@ class TestEmail(DirectoriesMixin, SampleDirMixin, APITestCase): checksum="4", filename="test4.pdf", ) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", doc4.source_path) + shutil.copy(self.SIMPLE_PDF, doc4.source_path) response = self.client.post( self.ENDPOINT, diff --git a/src/documents/tests/test_barcodes.py b/src/documents/tests/test_barcodes.py index c21f75fbc..b5ed64717 100644 --- a/src/documents/tests/test_barcodes.py +++ b/src/documents/tests/test_barcodes.py @@ -150,7 +150,7 @@ class TestBarcode( - No barcodes detected - No pages to split on """ - test_file = self.SAMPLE_DIR / "simple.pdf" + test_file = self.SIMPLE_PDF with self.get_reader(test_file) as reader: reader.detect() separator_page_numbers = reader.get_separation_pages() @@ -442,7 +442,7 @@ class TestBarcode( THEN: - Nothing happens """ - test_file = self.SAMPLE_DIR / "simple.pdf" + test_file = self.SIMPLE_PDF with self.get_reader(test_file) as reader: try: diff --git a/src/documents/tests/test_consumer.py b/src/documents/tests/test_consumer.py index a4e48379f..4b8150b93 100644 --- a/src/documents/tests/test_consumer.py +++ b/src/documents/tests/test_consumer.py @@ -36,6 +36,7 @@ from paperless_testing.assertions import FileSystemAssertsMixin from paperless_testing.dirs import DirectoriesMixin from paperless_testing.factories import UserFactory from paperless_testing.fakes.progress import FakeProgressManager +from paperless_testing.samples import SIMPLE_DIGITAL_PDF class _BaseNewStyleParser: @@ -1062,7 +1063,7 @@ class TestConsumer( @mock.patch("documents.consumer.get_parser_registry") def test_similar_filenames(self, m) -> None: shutil.copy( - Path(__file__).parent / "samples" / "simple.pdf", + SIMPLE_DIGITAL_PDF, settings.CONSUMPTION_DIR / "simple.pdf", ) shutil.copy( diff --git a/src/documents/tests/test_double_sided.py b/src/documents/tests/test_double_sided.py index 7ea806e93..c35b82486 100644 --- a/src/documents/tests/test_double_sided.py +++ b/src/documents/tests/test_double_sided.py @@ -37,12 +37,15 @@ class TestDoubleSided( self.double_sided_dir.mkdir() self.staging_file = self.dirs.scratch_dir / STAGING_FILE_NAME + def _sample(self, name: str) -> Path: + return self.SIMPLE_PDF if name == "simple.pdf" else self.SAMPLE_DIR / name + def consume_file(self, srcname, dstname: str | Path = "foo.pdf"): """ Starts the consume process and also ensures the destination file does not exist afterwards """ - src = self.SAMPLE_DIR / srcname + src = self._sample(srcname) dst = self.double_sided_dir / dstname dst.parent.mkdir(parents=True, exist_ok=True) shutil.copy(src, dst) @@ -57,7 +60,7 @@ class TestDoubleSided( return msg def create_staging_file(self, src="double-sided-odd.pdf", datetime=None) -> None: - shutil.copy(self.SAMPLE_DIR / src, self.staging_file) + shutil.copy(self._sample(src), self.staging_file) if datetime is None: datetime = dt.datetime.now() os.utime(str(self.staging_file), (datetime.timestamp(),) * 2) diff --git a/src/documents/tests/test_management.py b/src/documents/tests/test_management.py index a5a2e6233..bd3aa4d03 100644 --- a/src/documents/tests/test_management.py +++ b/src/documents/tests/test_management.py @@ -22,8 +22,9 @@ from documents.models import Document from documents.tasks import update_document_content_maybe_archive_file from paperless_testing.assertions import FileSystemAssertsMixin from paperless_testing.dirs import DirectoriesMixin +from paperless_testing.samples import SIMPLE_DIGITAL_PDF -sample_file: Path = Path(__file__).parent / "samples" / "simple.pdf" +sample_file: Path = SIMPLE_DIGITAL_PDF @pytest.mark.management diff --git a/src/documents/tests/test_management_thumbnails.py b/src/documents/tests/test_management_thumbnails.py index 4da0caf5a..595aedc64 100644 --- a/src/documents/tests/test_management_thumbnails.py +++ b/src/documents/tests/test_management_thumbnails.py @@ -11,6 +11,7 @@ from documents.models import Document from documents.parsers import get_default_thumbnail from paperless_testing.assertions import FileSystemAssertsMixin from paperless_testing.dirs import DirectoriesMixin +from paperless_testing.samples import SIMPLE_DIGITAL_PDF @pytest.mark.management @@ -24,7 +25,7 @@ class TestMakeThumbnails(DirectoriesMixin, FileSystemAssertsMixin, TestCase): filename="test.pdf", ) shutil.copy( - Path(__file__).parent / "samples" / "simple.pdf", + SIMPLE_DIGITAL_PDF, self.d1.source_path, ) @@ -36,7 +37,7 @@ class TestMakeThumbnails(DirectoriesMixin, FileSystemAssertsMixin, TestCase): filename="test2.pdf", ) shutil.copy( - Path(__file__).parent / "samples" / "simple.pdf", + SIMPLE_DIGITAL_PDF, self.d2.source_path, ) diff --git a/src/documents/tests/test_workflows.py b/src/documents/tests/test_workflows.py index 3bd9e0775..9f1d3a7b1 100644 --- a/src/documents/tests/test_workflows.py +++ b/src/documents/tests/test_workflows.py @@ -178,7 +178,7 @@ class TestWorkflows( self.assertEqual(action.__str__(), "WorkflowAction 1") test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -290,7 +290,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -409,7 +409,7 @@ class TestWorkflows( w2.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -478,7 +478,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -531,7 +531,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -608,7 +608,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -687,7 +687,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -765,7 +765,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -876,7 +876,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -928,7 +928,7 @@ class TestWorkflows( generated = generate_unique_filename(doc) destination = (settings.ORIGINALS_DIR / generated).resolve() create_source_path_directory(destination) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", destination) + shutil.copy(self.SIMPLE_PDF, destination) Document.objects.filter(pk=doc.pk).update(filename=generated.as_posix()) doc.refresh_from_db() @@ -2023,7 +2023,7 @@ class TestWorkflows( superuser = UserFactory(username="superuser", superuser=True) self.client.force_authenticate(user=superuser) test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) tasks.consume_file( @@ -3009,7 +3009,7 @@ class TestWorkflows( generated = generate_unique_filename(doc) destination = (settings.ORIGINALS_DIR / generated).resolve() create_source_path_directory(destination) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", destination) + shutil.copy(self.SIMPLE_PDF, destination) Document.objects.filter(pk=doc.pk).update(filename=generated.as_posix()) doc.refresh_from_db() doc.tags.set([self.t1, self.t2]) @@ -3073,7 +3073,7 @@ class TestWorkflows( generated = generate_unique_filename(doc) destination = (settings.ORIGINALS_DIR / generated).resolve() create_source_path_directory(destination) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", destination) + shutil.copy(self.SIMPLE_PDF, destination) Document.objects.filter(pk=doc.pk).update(filename=generated.as_posix()) doc.refresh_from_db() doc.tags.set([self.t1]) @@ -3222,7 +3222,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -3346,7 +3346,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -3496,7 +3496,7 @@ class TestWorkflows( workflow.actions.set([assignment_action, email_action]) temp_working_copy = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "working-copy.pdf", ) @@ -3596,7 +3596,7 @@ class TestWorkflows( # move the file test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -3704,7 +3704,7 @@ class TestWorkflows( generated = generate_unique_filename(doc) destination = (settings.ORIGINALS_DIR / generated).resolve() create_source_path_directory(destination) - shutil.copy(self.SAMPLE_DIR / "simple.pdf", destination) + shutil.copy(self.SIMPLE_PDF, destination) Document.objects.filter(pk=doc.pk).update(filename=generated.as_posix()) run_workflows(WorkflowTrigger.WorkflowTriggerType.DOCUMENT_UPDATED, doc) @@ -3915,7 +3915,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -4036,7 +4036,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -4387,7 +4387,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -4835,7 +4835,7 @@ class TestWorkflows( w.save() test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) @@ -5027,7 +5027,7 @@ class TestWorkflows( # Create a test file to be consumed test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) test_file_path = Path(test_file) @@ -5091,7 +5091,7 @@ class TestWorkflows( # Create a test file to be consumed test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple2.pdf", ) test_file_path = Path(test_file) @@ -5529,7 +5529,7 @@ class TestDateWorkflowLocalization( ) test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, tmp_path / "simple.pdf", ) @@ -5596,7 +5596,7 @@ class TestRemoteOCRWorkflowAction(DirectoriesMixin, SampleDirMixin, APITestCase) self._make_workflow(WorkflowTrigger.WorkflowTriggerType.CONSUMPTION) test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) overrides = DocumentMetadataOverrides() @@ -5814,7 +5814,7 @@ class TestApplyAISuggestionsWorkflowAction( ) test_file = shutil.copy( - self.SAMPLE_DIR / "simple.pdf", + self.SIMPLE_PDF, self.dirs.scratch_dir / "simple.pdf", ) diff --git a/src/documents/tests/utils.py b/src/documents/tests/utils.py index 63e907855..18769dfc9 100644 --- a/src/documents/tests/utils.py +++ b/src/documents/tests/utils.py @@ -11,6 +11,7 @@ from documents.data_models import ConsumableDocument from documents.data_models import DocumentMetadataOverrides from documents.data_models import DocumentSource from paperless_testing.fakes.progress import FakeProgressManager +from paperless_testing.samples import SIMPLE_DIGITAL_PDF class ConsumeTaskMixin: @@ -53,6 +54,8 @@ class SampleDirMixin: BARCODE_SAMPLE_DIR = SAMPLE_DIR / "barcodes" + SIMPLE_PDF = SIMPLE_DIGITAL_PDF + class GetConsumerMixin: @contextmanager