diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-16 11:51:51 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-16 11:51:51 +0100 |
commit | ed4f9bc53f52aaf3957d30658626a6ff794adcac (patch) | |
tree | 9eaa0e7b6b5bfa616376bf716d053ec4d6b93346 /pyblackbird_cc/resources/tests | |
parent | 1a335a83405a6b353c6c91b265db4dfdd85062fa (diff) |
Moving to pytest syntax for tests
Diffstat (limited to 'pyblackbird_cc/resources/tests')
-rw-r--r-- | pyblackbird_cc/resources/tests/test_models.py | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/pyblackbird_cc/resources/tests/test_models.py b/pyblackbird_cc/resources/tests/test_models.py index c7ed4d2..e1fe290 100644 --- a/pyblackbird_cc/resources/tests/test_models.py +++ b/pyblackbird_cc/resources/tests/test_models.py @@ -3,19 +3,19 @@ from unittest.mock import patch from django.test import TestCase -from ..models import PDFPageSnapshot -from ..models import PDFResource -from ..models import Resource -from ..models import ResourceCategory -from ..models import ResourceType -from ..views import ResourceInfo -from ..views import _extract_metadata_from_resource +from pyblackbird_cc.resources.models import PDFPageSnapshot +from pyblackbird_cc.resources.models import PDFResource +from pyblackbird_cc.resources.models import Resource +from pyblackbird_cc.resources.models import ResourceCategory +from pyblackbird_cc.resources.models import ResourceType +from pyblackbird_cc.resources.views import ResourceInfo +from pyblackbird_cc.resources.views import _extract_metadata_from_resource class ResourceModelTest(TestCase): def test_string_representation(self): resource = Resource(name="Test Resource") - self.assertEqual(str(resource), "Test Resource") + assert str(resource) == "Test Resource" @unittest.skip("Skipping this test for now as it is broken") @@ -38,11 +38,11 @@ class TestExtractMetadata(TestCase): mock_get_url.return_value = "https://example.com/url" result = _extract_metadata_from_resource(mock_resource) self.assertIsInstance(result, ResourceInfo) - self.assertEqual(result.name, "Test Resource") - self.assertEqual(result.pdf_filenames, "test.pdf") - self.assertEqual(result.thumbnail_filenames, ["thumb.jpg", "thumb2.jpg"]) - self.assertEqual(result.created, "2022-01-01") - self.assertEqual(result.updated, "2022-01-02") + assert result.name == "Test Resource" + 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" @unittest.skip("These tests will not run because they rely upon the view to get file size, etc.") |