Skip to content

Commit

Permalink
Fix eventlet wsgi websocket __call__ return
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiy-rodionov committed Jan 2, 2016
1 parent 118a829 commit 3f8eccc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion engineio/async_eventlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def __call__(self, environ, start_response):
raise RuntimeError('You need to use the eventlet server. '
'See the Deployment section of the '
'documentation for more information.')
super(WebSocketWSGI, self).__call__(environ, start_response)
return super(WebSocketWSGI, self).__call__(environ, start_response)


async = {
Expand Down
25 changes: 25 additions & 0 deletions tests/test_async_eventlet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import logging
import unittest

import six
if six.PY3:
from unittest import mock
else:
import mock

from engineio import async_eventlet


class TestServer(unittest.TestCase):
def setUp(self):
logging.getLogger('engineio').setLevel(logging.NOTSET)

@mock.patch('engineio.async_eventlet._WebSocketWSGI.__call__',
return_value='data')
def test_wsgi_call(self, _WebSocketWSGI):
_WebSocketWSGI.__call__ = lambda e,s: 'data'
environ = {"eventlet.input": None}
start_response = "bar"
wsgi = async_eventlet.WebSocketWSGI(None)
self.assertEqual(wsgi(environ, start_response), 'data')

0 comments on commit 3f8eccc

Please sign in to comment.