Demultiplexer testing with enforcing order
See original GitHub issueChannels 1.1.1
I’m tryign to do a test with a Demultiplexer, and it complains about enforcing ordering. I have the flag set, but do I have to add an order value to every message I send?
class ROSChannelTestCase(ChannelTestCase):
"""
ROS Channel Test Case
Test if we can do things
"""
def test_ros_channel(self):
client = HttpClient()
# user = User.objects.create_user(username='test', email='test@test.com', password='123456')
# client.login(username='test', password='123456')
with apply_routes([Demultiplexer.as_route(path='/new/')]):
client.send_and_consume(u'websocket.connect', path='/new/')
self.assertIsNone(client.receive())
File “/home/cjds/development/robot_configuration_interface/robot_configuration_interface/tests/unit/test_channels.py”, line 35, in test_ros_channel client.send_and_consume(u’websocket.connect’, path=‘/new/’) File “/usr/local/lib/python2.7/dist-packages/channels/test/http.py”, line 95, in send_and_consume return self.consume(channel, fail_on_none=fail_on_none, check_accept=check_accept) File “/usr/local/lib/python2.7/dist-packages/channels/test/http.py”, line 98, in consume result = super(HttpClient, self).consume(channel, fail_on_none=fail_on_none) File “/usr/local/lib/python2.7/dist-packages/channels/test/base.py”, line 136, in consume return consumer(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/base.py”, line 32, in init self.dispatch(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/base.py”, line 70, in dispatch return self.get_handler(message, **kwargs)(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/sessions.py”, line 78, in inner return func(*args, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/auth.py”, line 42, in inner return func(message, *args, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/websockets.py”, line 68, in raw_connect self.connect(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/websockets.py”, line 275, in connect consumer(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/base.py”, line 32, in init self.dispatch(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/generic/base.py”, line 70, in dispatch return self.get_handler(message, **kwargs)(message, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/sessions.py”, line 54, in inner return func(*args, **kwargs) File “/usr/local/lib/python2.7/dist-packages/channels/sessions.py”, line 125, in inner “can only be used on messages containing it.” ValueError: No
order
value in message; @enforce_ordering can only be used on messages containing it.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
@andrewgodwin maybe
HttpClient
has bad naming, but it designed to test WebSocket consumers. I can make PR to rename it… @cjds if you test consumers withenforce_ordering
you need to add order at message manually:A lot of the testing examples seem wrong, if this is not the way it works. I’ll see if I can edit it and improve it.