Require asgiref 1.0 and use receive instead of receive_many

As both daphne and asgiref had a 1.0 release, I think it makes sense to
require the presumably more stable asgiref 1.0. It's also a good
occasion to fix the deprecation warnings when running the tests by
switching to receive instead of receive_many.
This commit is contained in:
Maik Hoepfel 2017-01-30 15:54:45 +01:00
parent 51ffbca62a
commit 00984a0a8e
4 changed files with 11 additions and 11 deletions

View File

@ -115,7 +115,7 @@ class Server(object):
if channels:
delay = 0.01
try:
channel, message = self.channel_layer.receive_many(channels, block=False)
channel, message = self.channel_layer.receive(channels, block=False)
except Exception as e:
logger.error('Error at trying to receive messages: %s' % e)
delay = 5.00
@ -142,7 +142,7 @@ class Server(object):
channels = self.factory.reply_channels()
if channels:
try:
channel, message = yield self.channel_layer.receive_many_twisted(channels)
channel, message = yield self.channel_layer.receive_twisted(channels)
except Exception as e:
logger.error('Error at trying to receive messages: %s' % e)
yield self.sleep(5.00)

View File

@ -30,7 +30,7 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
self.assertEqual(message['http_version'], "1.1")
self.assertEqual(message['method'], "GET")
self.assertEqual(message['scheme'], "http")
@ -64,7 +64,7 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer, check root_path
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
self.assertEqual(message['root_path'], "/foobar /bar")
def test_http_disconnect_sets_path_key(self):
@ -78,7 +78,7 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the request message
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
# Send back an example response
self.factory.dispatch_reply(
@ -91,7 +91,7 @@ class TestHTTPProtocol(TestCase):
)
# Get the disconnection notification
_, disconnect_message = self.channel_layer.receive_many(["http.disconnect"])
_, disconnect_message = self.channel_layer.receive(["http.disconnect"])
self.assertEqual(disconnect_message['path'], "/te st-à/")
def test_x_forwarded_for_ignored(self):
@ -106,7 +106,7 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
self.assertEqual(message['client'], ['192.168.1.1', 54321])
def test_x_forwarded_for_parsed(self):
@ -123,7 +123,7 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
self.assertEqual(message['client'], ['10.1.2.3', 80])
def test_x_forwarded_for_port_missing(self):
@ -139,5 +139,5 @@ class TestHTTPProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer
_, message = self.channel_layer.receive_many(["http.request"])
_, message = self.channel_layer.receive(["http.request"])
self.assertEqual(message['client'], ['10.1.2.3', 0])

View File

@ -33,7 +33,7 @@ class TestWebSocketProtocol(TestCase):
b"\r\n"
)
# Get the resulting message off of the channel layer
_, message = self.channel_layer.receive_many(["websocket.connect"])
_, message = self.channel_layer.receive(["websocket.connect"])
self.assertEqual(message['path'], "/chat")
self.assertEqual(message['query_string'], "")
self.assertEqual(

View File

@ -23,7 +23,7 @@ setup(
packages=find_packages() + ['twisted.plugins'],
include_package_data=True,
install_requires=[
'asgiref>=0.13',
'asgiref>=1.0.0',
'twisted>=16.0',
'autobahn>=0.12',
],