mirror of
https://github.com/django/daphne.git
synced 2024-11-28 18:53:44 +03:00
Fix HTTP test
This commit is contained in:
parent
e9d61fc1c8
commit
8848f19079
|
@ -1,3 +1,4 @@
|
||||||
|
# coding: utf8
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from asgiref.inmemory import ChannelLayer
|
from asgiref.inmemory import ChannelLayer
|
||||||
|
@ -28,7 +29,7 @@ class TestHTTPProtocol(TestCase):
|
||||||
"""
|
"""
|
||||||
# Send a simple request to the protocol
|
# Send a simple request to the protocol
|
||||||
self.proto.dataReceived(
|
self.proto.dataReceived(
|
||||||
b"GET /test/?foo=bar HTTP/1.1\r\n" +
|
b"GET /te%20st-%C3%A0/?foo=bar HTTP/1.1\r\n" +
|
||||||
b"Host: somewhere.com\r\n" +
|
b"Host: somewhere.com\r\n" +
|
||||||
b"\r\n"
|
b"\r\n"
|
||||||
)
|
)
|
||||||
|
@ -37,8 +38,8 @@ class TestHTTPProtocol(TestCase):
|
||||||
self.assertEqual(message['http_version'], "1.1")
|
self.assertEqual(message['http_version'], "1.1")
|
||||||
self.assertEqual(message['method'], "GET")
|
self.assertEqual(message['method'], "GET")
|
||||||
self.assertEqual(message['scheme'], "http")
|
self.assertEqual(message['scheme'], "http")
|
||||||
self.assertEqual(message['path'], b"/test/")
|
self.assertEqual(message['path'], "/te st-à/")
|
||||||
self.assertEqual(message['query_string'], b"foo=bar")
|
self.assertEqual(message['query_string'], "foo=bar")
|
||||||
self.assertEqual(message['headers'], [(b"host", b"somewhere.com")])
|
self.assertEqual(message['headers'], [(b"host", b"somewhere.com")])
|
||||||
self.assertFalse(message.get("body", None))
|
self.assertFalse(message.get("body", None))
|
||||||
self.assertTrue(message['reply_channel'])
|
self.assertTrue(message['reply_channel'])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user