mime types

This commit is contained in:
2024-01-13 20:06:04 +01:00
parent 892df0144e
commit c21167f941
5 changed files with 38 additions and 43 deletions

Binary file not shown.

View File

@@ -5,20 +5,20 @@ from src.mime_types import MimeTypes
class TestMimeTypes(unittest.TestCase):
def test_mime_type_image(self):
mime_type = MimeTypes(file_type="image")
assert mime_type.image
assert not mime_type.video
assert not mime_type.unsupported_file_type
mime_type = MimeTypes(file_path="tests/test_files/test_image_001.JPG")
assert mime_type.is_image
assert not mime_type.is_video
assert not mime_type.is_unsupported_file_type
def test_mime_type_video(self):
mime_type = MimeTypes(file_type="video")
assert not mime_type.image
assert mime_type.video
assert not mime_type.unsupported_file_type
mime_type = MimeTypes(file_path="tests/test_files/test_video.mp4")
assert not mime_type.is_image
assert mime_type.is_video
assert not mime_type.is_unsupported_file_type
def test_mime_type_unsupported_file_type(self):
mime_type = MimeTypes(file_type="not_a_valid_file_type")
assert not mime_type.image
assert not mime_type.video
assert mime_type.unsupported_file_type
mime_type = MimeTypes(file_path="tests/test_mime_types.py")
assert not mime_type.is_image
assert not mime_type.is_video
assert mime_type.is_unsupported_file_type