2021-05-08 03:49:42 +02:00
|
|
|
# vim: set fileencoding=utf-8
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
from bemani.data.api.client import APIClient
|
|
|
|
|
|
|
|
|
|
|
|
class TestAPIClient(unittest.TestCase):
|
|
|
|
def test_content_type(self) -> None:
|
2022-10-15 20:56:30 +02:00
|
|
|
client = APIClient("https://127.0.0.1", "token", False, False)
|
|
|
|
self.assertFalse(client._content_type_valid("application/text"))
|
|
|
|
self.assertFalse(client._content_type_valid("application/json"))
|
|
|
|
self.assertFalse(
|
|
|
|
client._content_type_valid("application/json; charset=shift-jis")
|
|
|
|
)
|
|
|
|
self.assertTrue(client._content_type_valid("application/json; charset=utf-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json;charset=utf-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json;charset = utf-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json; charset = utf-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json; charset=UTF-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json;charset=UTF-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json;charset = UTF-8"))
|
|
|
|
self.assertTrue(client._content_type_valid("application/json; charset = UTF-8"))
|