Skip to content

Commit

Permalink
fix aiohttp unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelgrinberg committed Mar 5, 2018
1 parent 810e759 commit 4b3ee93
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions tests/test_async_aiohttp.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@
import mock

if sys.version_info >= (3, 5):
from aiohttp import web
from engineio import async_aiohttp


@unittest.skipIf(sys.version_info < (3, 5), 'only for Python 3.5+')
class AiohttpTests(unittest.TestCase):
@mock.patch('aiohttp.web_urldispatcher.UrlDispatcher.add_route')
def test_create_route(self, add_route):
app = web.Application()
def test_create_route(self):
app = mock.MagicMock()
mock_server = mock.MagicMock()
async_aiohttp.create_route(app, mock_server, '/foo')
add_route.assert_any_call('GET', '/foo', mock_server.handle_request,
name=None)
add_route.assert_any_call('POST', '/foo', mock_server.handle_request)
app.router.add_get.assert_any_call('/foo', mock_server.handle_request)
app.router.add_post.assert_any_call('/foo', mock_server.handle_request)

def test_translate_request(self):
request = mock.MagicMock()
Expand Down

0 comments on commit 4b3ee93

Please sign in to comment.