tornado-openapi3/tests/test_util.py
Correl Roush 513166456a Parse mimetype from content-type
OpenAPI objects expect lowercased mimetypes, with parameters stripped.
2021-01-13 14:33:39 -05:00

16 lines
537 B
Python

import unittest
from tornado_openapi3 import util
class TestMimetypeParsing(unittest.TestCase):
def test_parameters_are_stripped(self) -> None:
self.assertEqual("text/html", util.parse_mimetype("text/html; charset=utf-8"))
def test_mimetype_is_lowercase(self) -> None:
self.assertEqual("text/html", util.parse_mimetype("TEXT/HTML"))
def test_type_suffix_is_preserved(self) -> None:
self.assertEqual(
"application/custom+json", util.parse_mimetype("application/custom+json")
)