21 changed files with 42 additions and 31 deletions
@ -0,0 +1,5 @@ |
|||||
|
[aliases] |
||||
|
test=pytest |
||||
|
|
||||
|
[tool:pytest] |
||||
|
python_files = tests/*.py |
@ -1,18 +1,18 @@ |
|||||
from unittest import TestCase |
from unittest import TestCase |
||||
|
|
||||
|
from tests.utils import APIClient |
||||
|
|
||||
|
|
||||
class TestReason(TestCase): |
class TestReason(TestCase): |
||||
def test_set_unicode_reason(self): |
def test_set_unicode_reason(self): |
||||
from tests.utils import TestAPIClient |
api = APIClient() |
||||
api = TestAPIClient() |
|
||||
api.guilds_channels_modify(1, 2, 3, reason=u'yo \U0001F4BF test') |
api.guilds_channels_modify(1, 2, 3, reason=u'yo \U0001F4BF test') |
||||
|
|
||||
_, kwargs = api.http.calls[0] |
_, kwargs = api.http.calls[0] |
||||
self.assertEqual(kwargs['headers']['X-Audit-Log-Reason'], 'yo%20%F0%9F%92%BF%20test') |
self.assertEqual(kwargs['headers']['X-Audit-Log-Reason'], 'yo%20%F0%9F%92%BF%20test') |
||||
|
|
||||
def test_null_reason(self): |
def test_null_reason(self): |
||||
from tests.utils import TestAPIClient |
api = APIClient() |
||||
api = TestAPIClient() |
|
||||
api.guilds_channels_modify(1, 2, 3, reason=None) |
api.guilds_channels_modify(1, 2, 3, reason=None) |
||||
|
|
||||
_, kwargs = api.http.calls[0] |
_, kwargs = api.http.calls[0] |
@ -0,0 +1,20 @@ |
|||||
|
from disco.gateway.events import GatewayEvent, Resumed |
||||
|
|
||||
|
|
||||
|
def create_resumed_payload(): |
||||
|
return GatewayEvent.from_dispatch(None, { |
||||
|
't': 'RESUMED', |
||||
|
'd': { |
||||
|
'_trace': ['test', '1', '2', '3'], |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
def test_from_dispatch(): |
||||
|
event = create_resumed_payload() |
||||
|
assert isinstance(event, Resumed) |
||||
|
assert event.trace == ['test', '1', '2', '3'] |
||||
|
|
||||
|
|
||||
|
def test_event_creation(benchmark): |
||||
|
benchmark(create_resumed_payload) |
Loading…
Reference in new issue