Fix HTTP test

This commit is contained in:
Andrew Godwin 2016-04-26 13:43:14 +01:00
parent e9d61fc1c8
commit 8848f19079

View File

@ -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'])