Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Mar 5, 2018
1 parent 0d3e526 commit 859945d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions sockjs/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class SockjsMessage(collections.namedtuple('SockjsMessage', ['type', 'data'])):
def tp(self):
return self.type


OpenMessage = SockjsMessage(MSG_OPEN, None)
CloseMessage = SockjsMessage(MSG_CLOSE, None)
ClosedMessage = SockjsMessage(MSG_CLOSED, None)
10 changes: 5 additions & 5 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ async def test_remote_close(self, make_session):
assert session.state == protocol.STATE_CLOSING
assert messages == \
[(protocol.SockjsMessage(
tp=protocol.MSG_CLOSE, data=None), session)]
protocol.MSG_CLOSE, None), session)]

async def test_remote_close_idempotent(self, make_session):
messages = []
Expand All @@ -301,7 +301,7 @@ async def test_remote_close_with_exc(self, make_session):
assert session.interrupted
assert session.state == protocol.STATE_CLOSING
assert messages == \
[(protocol.SockjsMessage(tp=protocol.MSG_CLOSE, data=exc),
[(protocol.SockjsMessage(protocol.MSG_CLOSE, exc),
session)]

async def test_remote_close_exc_in_handler(self,
Expand Down Expand Up @@ -358,7 +358,7 @@ async def test_remote_message(self, make_session):

await session._remote_message('msg')
assert messages == \
[(protocol.SockjsMessage(tp=protocol.MSG_MESSAGE, data='msg'),
[(protocol.SockjsMessage(protocol.MSG_MESSAGE, 'msg'),
session)]

async def test_remote_message_exc(self, make_handler, make_session):
Expand All @@ -375,9 +375,9 @@ async def test_remote_messages(self, make_session):

await session._remote_messages(('msg1', 'msg2'))
assert messages == \
[(protocol.SockjsMessage(tp=protocol.MSG_MESSAGE, data='msg1'),
[(protocol.SockjsMessage(protocol.MSG_MESSAGE, 'msg1'),
session),
(protocol.SockjsMessage(tp=protocol.MSG_MESSAGE, data='msg2'),
(protocol.SockjsMessage(protocol.MSG_MESSAGE, 'msg2'),
session)]

async def test_remote_messages_exc(self, make_handler, make_session):
Expand Down

0 comments on commit 859945d

Please sign in to comment.