Skip to content

Commit

Permalink
test: add test case for InvalidStateError
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrokiefer committed Apr 29, 2018
1 parent f0b42be commit da4311b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,32 @@ async def test_can_process_messages(self, message_handle_mock):
await asyncio.sleep(0.001)
message_handle_mock.assert_called_once()

@patch('aiostomp.aiostomp.StompReader._handle_message')
@unittest_run_loop
async def test_consecutive_calls_data_received(self, message_handle_mock):
stomp = StompReader(None, self.loop)

await asyncio.sleep(0.001)

stomp.data_received(
b'MESSAGE\n'
b'subscription:1\n'
b'message-id:007\n'
b'destination:/topic/test\n'
b'\n'
b'blahh-line-a\n\nblahh-line-b\n\nblahh-line-c\x00')

stomp.data_received(
b'MESSAGE\n'
b'subscription:1\n'
b'message-id:007\n'
b'destination:/topic/test\n'
b'\n'
b'blahh-line-a\n\nblahh-line-b\n\nblahh-line-c\x00')

await asyncio.sleep(0.001)
self.assertEqual(message_handle_mock.call_count, 2)

@unittest_run_loop
async def test_can_handle_message(self):
frame = Frame('MESSAGE', {
Expand Down

0 comments on commit da4311b

Please sign in to comment.