From 55e5dfbd51924f1f23e5a651d830206be01e376c Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 16 May 2024 16:57:14 +0100 Subject: wip: starting to test feature resource functionality with factories --- pyblackbird_cc/resources/tests/test_models.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'pyblackbird_cc/resources/tests/test_models.py') diff --git a/pyblackbird_cc/resources/tests/test_models.py b/pyblackbird_cc/resources/tests/test_models.py index e1fe290..c54120c 100644 --- a/pyblackbird_cc/resources/tests/test_models.py +++ b/pyblackbird_cc/resources/tests/test_models.py @@ -1,6 +1,7 @@ import unittest from unittest.mock import patch +import pytest from django.test import TestCase from pyblackbird_cc.resources.models import PDFPageSnapshot @@ -12,10 +13,15 @@ from pyblackbird_cc.resources.views import ResourceInfo from pyblackbird_cc.resources.views import _extract_metadata_from_resource +@pytest.mark.django_db +def test_resource_model(resources): + assert Resource.objects.filter(name="Default Resource 1").exists() + + class ResourceModelTest(TestCase): def test_string_representation(self): resource = Resource(name="Test Resource") - assert str(resource) == "Test Resource" + assert str(resource) == "Test Resource" @unittest.skip("Skipping this test for now as it is broken") @@ -39,7 +45,7 @@ class TestExtractMetadata(TestCase): result = _extract_metadata_from_resource(mock_resource) self.assertIsInstance(result, ResourceInfo) assert result.name == "Test Resource" - assert result.pdf_filenames == "test.pdf" + assert result.pdf_filenames == "test.pdf" assert result.thumbnail_filenames in ["thumb.jpg", "thumb2.jpg"] assert result.created == "2022-01-01" assert result.updated == "2022-01-02" -- cgit v1.2.3