Adds test

This commit is contained in:
Mouse Reeve 2021-08-02 19:01:23 -07:00
parent 9e6f78c0f5
commit b7563ca221

View file

@ -426,6 +426,17 @@ class ActivitypubFields(TestCase):
self.assertIsInstance(loaded_image, list)
self.assertIsInstance(loaded_image[1], ContentFile)
def test_image_serialize(self):
"""make sure we're creating sensible image paths"""
ValueMock = namedtuple(
"ValueMock", ("url")
)
value_mock = ValueMock("images/fish.jpg")
result = fields.image_serializer(value_mock, "hello")
self.assertEqual(result.type, "Document")
self.assertEqual(result.url, "https://test.com/images/fish.jpg")
self.assertEqual(result.name, "hello")
def test_datetime_field(self):
"""this one is pretty simple, it just has to use isoformat"""
instance = fields.DateTimeField()