def test_flush_pending_events_flushes_all_leading_frames(self): conn = mock() c = Channel(conn, 42, {}) f1 = MethodFrame(1, 2, 3) f2 = MethodFrame(1, 2, 3) f3 = MethodFrame(1, 2, 3) c._pending_events = deque([f1, f2, 'cb', f3]) expect(conn.send_frame).args(f1) expect(conn.send_frame).args(f2) c._flush_pending_events() assert_equals(deque(['cb', f3]), c._pending_events)
def test_flush_pending_events_flushes_all_leading_frames(self): conn = mock() c = Channel(conn, 42, {}) f1 = MethodFrame(1, 2, 3) f2 = MethodFrame(1, 2, 3) f3 = MethodFrame(1, 2, 3) c._pending_events = deque([f1, f2, 'cb', f3]) expect(conn.send_frame).args(f1) expect(conn.send_frame).args(f2) c._flush_pending_events() assertEquals(deque(['cb', f3]), c._pending_events)