diff options
Diffstat (limited to '')
-rw-r--r-- | pyblackbird_cc/resources/tests/conftest.py | 8 | ||||
-rw-r--r-- | pyblackbird_cc/resources/tests/test_models.py | 10 |
2 files changed, 16 insertions, 2 deletions
diff --git a/pyblackbird_cc/resources/tests/conftest.py b/pyblackbird_cc/resources/tests/conftest.py new file mode 100644 index 0000000..0d1ed87 --- /dev/null +++ b/pyblackbird_cc/resources/tests/conftest.py @@ -0,0 +1,8 @@ +import pytest + +from pyblackbird_cc.resources.factories import ResourceModelFactory + + +@pytest.fixture() +def resources(): + return ResourceModelFactory.create_batch(5) 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" |