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()
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()
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)