diff --git a/make_post_sell/tests/test_player.py b/make_post_sell/tests/test_player.py index 1c98422..bfe0f4e 100644 --- a/make_post_sell/tests/test_player.py +++ b/make_post_sell/tests/test_player.py @@ -1,7 +1,7 @@ import unittest from pyramid import testing -from ..models.product import get_media_type, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS, IMAGE_EXTENSIONS +from ..models.product import get_media_type, VIDEO_EXTENSIONS, AUDIO_EXTENSIONS, IMAGE_EXTENSIONS, DOCUMENT_EXTENSIONS class TestMediaTypeDetection(unittest.TestCase): @@ -28,9 +28,16 @@ class TestMediaTypeDetection(unittest.TestCase): # Test case insensitivity self.assertEqual(get_media_type(ext.upper()), "image") + def test_document_extensions(self): + """Test that document extensions are correctly identified.""" + for ext in DOCUMENT_EXTENSIONS: + self.assertEqual(get_media_type(ext), "document") + # Test case insensitivity + self.assertEqual(get_media_type(ext.upper()), "document") + def test_unsupported_extensions(self): """Test that unsupported extensions return None.""" - unsupported = ["pdf", "zip", "doc", "txt", "exe"] + unsupported = ["zip", "doc", "txt", "exe", "docx"] for ext in unsupported: self.assertIsNone(get_media_type(ext)) @@ -98,6 +105,9 @@ class TestPlayerView(unittest.TestCase): for ext in IMAGE_EXTENSIONS: self.assertEqual(ext, ext.lower(), f"IMAGE_EXTENSIONS contains non-lowercase: {ext}") + for ext in DOCUMENT_EXTENSIONS: + self.assertEqual(ext, ext.lower(), f"DOCUMENT_EXTENSIONS contains non-lowercase: {ext}") + if __name__ == "__main__": unittest.main()