def test_heartbeat_transport(self): session = self.make_session('test') session._heartbeat_transport = True session._heartbeat() self.assertEqual( list(session._queue), [(protocol.FRAME_HEARTBEAT, protocol.FRAME_HEARTBEAT)])
def test_heartbeat(self): session = self.make_session('test') session._tick = mock.Mock() self.assertEqual(session._heartbeats, 0) session._heartbeat() self.assertEqual(session._heartbeats, 1) session._heartbeat() self.assertEqual(session._heartbeats, 2) self.assertEqual(session._tick.call_count, 2)