mirror of
https://github.com/django/daphne.git
synced 2025-07-10 16:02:18 +03:00
Remove invalid test. FileResponse requires a file object. (#311)
* Remove invalid test. FileResponse requires a file object. * rm unused imports
This commit is contained in:
parent
860da6e241
commit
39339e66bc
|
@ -1,7 +1,6 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import unittest
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
|
|
||||||
|
@ -9,7 +8,7 @@ from django.http import (
|
||||||
FileResponse, HttpResponse, HttpResponseRedirect, JsonResponse,
|
FileResponse, HttpResponse, HttpResponseRedirect, JsonResponse,
|
||||||
StreamingHttpResponse,
|
StreamingHttpResponse,
|
||||||
)
|
)
|
||||||
from six import BytesIO, StringIO
|
from six import BytesIO
|
||||||
|
|
||||||
from channels import Channel
|
from channels import Channel
|
||||||
from channels.handler import AsgiHandler
|
from channels.handler import AsgiHandler
|
||||||
|
@ -357,18 +356,3 @@ class HandlerTests(ChannelTestCase):
|
||||||
self.assertEqual(reply_messages[0]['status'], 302)
|
self.assertEqual(reply_messages[0]['status'], 302)
|
||||||
header_dict = dict(reply_messages[0]['headers'])
|
header_dict = dict(reply_messages[0]['headers'])
|
||||||
self.assertEqual(header_dict[b'Location'].decode(), redirect_to)
|
self.assertEqual(header_dict[b'Location'].decode(), redirect_to)
|
||||||
|
|
||||||
@unittest.skip("failing under python 3")
|
|
||||||
def test_stringio_file_response(self):
|
|
||||||
Channel("test").send({
|
|
||||||
"reply_channel": "test",
|
|
||||||
"http_version": "1.1",
|
|
||||||
"method": "GET",
|
|
||||||
"path": b"/test/",
|
|
||||||
})
|
|
||||||
response = FileResponse(StringIO('sadfdasfsdfsadf'))
|
|
||||||
handler = FakeAsgiHandler(response)
|
|
||||||
# Use islice because the generator never ends.
|
|
||||||
reply_messages = list(
|
|
||||||
islice(handler(self.get_next_message("test", require=True)), 5))
|
|
||||||
self.assertEqual(len(reply_messages), 2, reply_messages)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user