3 changed files with 28 additions and 2 deletions
@ -0,0 +1,11 @@ |
|||
from unittest import TestCase |
|||
from utils import TestAPIClient |
|||
|
|||
|
|||
class TestReason(TestCase): |
|||
def test_set_unicode_reason(self): |
|||
api = TestAPIClient() |
|||
api.guilds_channels_modify(1, 2, 3, reason=u'yo \U0001F4BF test') |
|||
|
|||
_, kwargs = api.http.calls[0] |
|||
self.assertEquals(kwargs['headers']['X-Audit-Log-Reason'], 'yo%20%F0%9F%92%BF%20test') |
@ -0,0 +1,15 @@ |
|||
from disco.api.client import APIClient |
|||
|
|||
|
|||
class CallContainer(object): |
|||
def __init__(self): |
|||
self.calls = [] |
|||
|
|||
def __call__(self, *args, **kwargs): |
|||
self.calls.append((args, kwargs)) |
|||
|
|||
|
|||
class TestAPIClient(APIClient): |
|||
def __init__(self): |
|||
self.client = None |
|||
self.http = CallContainer() |
Loading…
Reference in new issue