aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/tests
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-06-22 16:34:09 +0100
committerMatthew Lemon <y@yulqen.org>2024-06-22 16:36:17 +0100
commitdffe4f530812ff4087622523a598085255abc00c (patch)
treeb54d1a9f558bd13b4e030348364a682efd343b51 /pyblackbird_cc/resources/tests
parent3e55a1d2843805de40714a3e920b97cf546966f1 (diff)
Fixes bug where multiple PDFs not snappshotted
Includes test of new function which determines the length and composition of the snappshotted pages.
Diffstat (limited to 'pyblackbird_cc/resources/tests')
-rw-r--r--pyblackbird_cc/resources/tests/test_file_processing.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/tests/test_file_processing.py b/pyblackbird_cc/resources/tests/test_file_processing.py
index 40cc5eb..cbb4972 100644
--- a/pyblackbird_cc/resources/tests/test_file_processing.py
+++ b/pyblackbird_cc/resources/tests/test_file_processing.py
@@ -5,6 +5,8 @@ from django.core.files.uploadedfile import TemporaryUploadedFile
from django.test import TestCase
from django.urls import reverse
+from pyblackbird_cc.resources.views import _get_pdf_collection_type
+
from .. import services
""" Explanation:
@@ -36,6 +38,18 @@ We also test the integrity of the uploaded PDF file here by checking the number
"""
+def test_detect_snapshotted_pdf_collection():
+ single_pdf_single_page = [["toss"]]
+ single_pdf_multi_page = [["toss2", "toss8"]]
+ multi_pdf_single_page = [["toss"], ["toss2"]]
+ multi_pdf_multi_page = [["toss", "toss2"], ["toss", "toss2"]]
+
+ assert _get_pdf_collection_type(single_pdf_single_page) == "SINGLE_PDF_SINGLE_PAGE"
+ assert _get_pdf_collection_type(single_pdf_multi_page) == "SINGLE_PDF_MULTI_PAGE"
+ assert _get_pdf_collection_type(multi_pdf_single_page) == "MULTI_PDF_SINGLE_PAGE"
+ assert _get_pdf_collection_type(multi_pdf_multi_page) == "MULTI_PDF_MULTI_PAGE"
+
+
class PDFFileUploadTestCase(TestCase):
def setUp(self):
self.url = reverse("resources:create_resource")