Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,25 @@ def test_match_video_audio_type_pattern(self, expected_type, resource):
def test_match_font_type_pattern(self, expected_type, resource):
computed_type = match.match_font_type_pattern(resource)
assert computed_type == expected_type

class TestArchiveMatching:
""" Class to test pattern matching of archive Mimetypes"""

mime_types = ['application/x-gzip', 'application/zip', 'application/x-rar-compressed']
content = [
b'\x1F\x8B\x08',
b'\x50\x4B\x03\x04',
b'\x52\x61\x72\x20\x1A\x07\x00'
]

@pytest.mark.parametrize('mime, resource', list(zip(mime_types, content)))
def test_match_archive_pattern(self, mime, resource):
computed_type = match.match_archive_type_pattern(resource)
actual_type = parse_mime_type(mime)
assert computed_type == actual_type

@pytest.mark.parametrize('expected_type, resource', get_resource_test_list(["archive"]))
def test_match_archive_pattern_file(self, expected_type, resource):
computed_type = match.match_archive_type_pattern(resource)
assert computed_type == expected_type