Example #1
0
    def test_can_close_connection(self):
        frame_handler = Mock()
        heartbeater = Mock()

        stomp = StompReader(frame_handler, self.loop)
        stomp.heartbeater = heartbeater

        stomp.close()

        heartbeater.shutdown.assert_called_once()
Example #2
0
    def test_can_close_connection_no_heartbeat(self):
        frame_handler = Mock()
        heartbeater = Mock()

        stomp = StompReader(frame_handler, self.loop)
        stomp.heartbeater = None

        stomp.close()

        heartbeater.shutdown.assert_not_called()
Example #3
0
    def test_connection_can_be_lost_no_heartbeat(self):
        frame_handler = Mock()
        heartbeater = Mock()

        stomp = StompReader(frame_handler, self.loop)
        stomp.heartbeater = None
        exc = Exception()

        stomp.connection_lost(exc)

        heartbeater.shutdown.assert_not_called()
        frame_handler.connection_lost.assert_called_with(exc)