Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Jan 5, 2015
1 parent 35e8e2c commit 4f2ff77
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_web_websocket_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def connect_ws(self, url, protocol='chat'):

def test_send_recv_text(self):

closed = asyncio.Future(loop=self.loop)

@asyncio.coroutine
def handler(request):
ws = web.WebSocketResponse()
Expand All @@ -88,6 +90,10 @@ def handler(request):
msg = yield from ws.receive()
ws.send_str(msg+'/answer')
ws.close()
try:
yield from ws.receive()
except web.WebSocketDisconnectedError:
closed.set_result(None)
return ws

@asyncio.coroutine
Expand All @@ -104,6 +110,10 @@ def go():
self.assertEqual(msg.data, 1000)
self.assertEqual(msg.extra, b'')

writer.close()

yield from closed

self.loop.run_until_complete(go())

def test_send_recv_bytes(self):
Expand Down

0 comments on commit 4f2ff77

Please sign in to comment.