diff options
Diffstat (limited to 'pyblackbird_cc/resources')
-rw-r--r-- | pyblackbird_cc/resources/models.py | 3 | ||||
-rw-r--r-- | pyblackbird_cc/resources/tests/test_models.py | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/models.py b/pyblackbird_cc/resources/models.py index 6ecf525..7bbf244 100644 --- a/pyblackbird_cc/resources/models.py +++ b/pyblackbird_cc/resources/models.py @@ -115,6 +115,9 @@ class Resource(models.Model): def get_absolute_url(self): return reverse("resources:resource_detail", kwargs={"resource_id": self.pk}) + def thumbnail_urls(self): + ri = _extract_metadata_from_resource(self) + class ResourceType(models.Model): name = models.CharField(max_length=255, null=False) diff --git a/pyblackbird_cc/resources/tests/test_models.py b/pyblackbird_cc/resources/tests/test_models.py index 7398c43..40c13e4 100644 --- a/pyblackbird_cc/resources/tests/test_models.py +++ b/pyblackbird_cc/resources/tests/test_models.py @@ -111,3 +111,9 @@ class TestPDFResourceModel(TestCase): def test_get_pdf_snapshot_filenames(self): self.assertEqual(self.pdf_resource.snapshot_file_names(), ["test_resource_1.jpg"]) + + +@pytest.mark.django_db() +def test_get_urls_of_resource_snapshot_images(resource): + assert len(resource.thumbnail_filenames) == 3 + |