aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/tests/test_models.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyblackbird_cc/resources/tests/test_models.py')
-rw-r--r--pyblackbird_cc/resources/tests/test_models.py14
1 files changed, 5 insertions, 9 deletions
diff --git a/pyblackbird_cc/resources/tests/test_models.py b/pyblackbird_cc/resources/tests/test_models.py
index 2e45d39..7398c43 100644
--- a/pyblackbird_cc/resources/tests/test_models.py
+++ b/pyblackbird_cc/resources/tests/test_models.py
@@ -18,18 +18,14 @@ from pyblackbird_cc.resources.views import _extract_metadata_from_resource
@pytest.mark.django_db()
def test_resource_model(resources):
- # Create a resource
r1 = resources[0]
- # Get the first pdf resource on the resource
pdf_on_rw = r1.pdf_resources.first()
- # Create a single pdf_page_shapshot and associate it with the pdf resource on the resource
pdf_page_snapshot = PDFPageSnapshotModelFactory(pdf_file=pdf_on_rw)
- assert Resource.objects.filter(name="Default Resource 1").exists()
- assert "test_0.pdf" in r1.get_pdf_file_names()
- assert "test_1.pdf" in r1.get_pdf_file_names()
- assert "test_2.pdf" in r1.get_pdf_file_names()
- assert "test_3.pdf" not in r1.get_pdf_file_names()
- assert "pdf_page_snapshot_0.jpg" in r1.get_pdf_snapshot_file_names()
+
+ assert Resource.objects.filter(id=r1.id).exists()
+ assert any("test_" in name for name in r1.get_pdf_file_names())
+ assert len(r1.get_pdf_file_names()) == 3
+ assert "pdf_page_snapshot_" in r1.get_pdf_snapshot_file_names()[0]
@pytest.mark.django_db()