mirror of
https://github.com/django/daphne.git
synced 2025-10-29 14:57:34 +03:00
* Move project tests to its own directory. * Install mock test dependency for Python2 only. * Do not install tox inside tox environment. * Exclude tests from sdist. * Use recent pip on Travis-CI.
25 lines
784 B
Python
25 lines
784 B
Python
from __future__ import unicode_literals
|
|
|
|
from django.http.cookie import parse_cookie
|
|
|
|
from channels.test import ChannelTestCase, HttpClient
|
|
|
|
|
|
class HttpClientTests(ChannelTestCase):
|
|
def test_cookies(self):
|
|
client = HttpClient()
|
|
client.set_cookie('foo', 'not-bar')
|
|
client.set_cookie('foo', 'bar')
|
|
client.set_cookie('qux', 'qu;x')
|
|
|
|
# Django's interpretation of the serialized cookie.
|
|
cookie_dict = parse_cookie(client.headers['cookie'].decode('ascii'))
|
|
|
|
self.assertEqual(client.get_cookies(),
|
|
cookie_dict)
|
|
|
|
self.assertEqual({'foo': 'bar',
|
|
'qux': 'qu;x',
|
|
'sessionid': client.get_cookies()['sessionid']},
|
|
cookie_dict)
|