Skip to content

Commit

Permalink
🧪 [#4795] Add test for msg file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen authored and sergei-maertens committed Dec 27, 2024
1 parent d49defd commit 26986fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Binary file added src/openforms/formio/tests/files/test.msg
Binary file not shown.
16 changes: 16 additions & 0 deletions src/openforms/formio/tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,22 @@ def test_allowed_mime_types_for_csv_files(self):

validator(sample)

def test_allowed_mime_types_for_msg_files(self):
valid_type = "application/vnd.ms-outlook"
msg_file = TEST_FILES / "test.msg"
validator = validators.MimeTypeValidator(allowed_mime_types=[valid_type])

# 4795
# The sdk cannot determine the content_type for .msg files correctly.
# Because .msg is a windows specific file, and linux and MacOS don't know it.
# So we simulate the scenario where content_type is unknown
sample = SimpleUploadedFile(
"test.msg",
msg_file.read_bytes(),
)

validator(sample)

def test_validate_files_multiple_mime_types(self):
"""Assert that validation of files associated with multiple mime types works
Expand Down

0 comments on commit 26986fd

Please sign in to comment.